﻿    /* =========================================================================
       HIGH-DENSITY ENTERPRISE WORKSPACE LAYOUT (PALANTIR / BLOOMBERG STYLE)
       ========================================================================= */
    :root {
      --topbar-height: 52px;
      --cmd-height: 44px;
      --strip-height: 34px;
      --tree-width: 250px;
      --border-color: rgba(255, 255, 255, 0.08);
      --bg-tree: #0c121e;
      --bg-grid: #080d1a;
      --bg-panel: #0f172a;
      --brand-blue: #3b82f6;
    }
    html, body {
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
      background: var(--bg-main);
      color: var(--text-primary);
      font-family: var(--font-sans);
    }
    .doc-app-wrap {
      display: flex;
      flex-direction: column;
      height: 100vh;
      width: 100vw;
      overflow: hidden;
    }
    /* Command Bar (Toolbar) */
    .doc-cmd-bar {
      height: var(--cmd-height);
      background: rgba(15, 23, 42, 0.94);
      border-bottom: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 12px;
      gap: 10px;
      flex-shrink: 0;
      z-index: 10;
    }
    .doc-cmd-left {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .btn-toggle-tree {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-color);
      color: var(--text-secondary);
      width: 32px;
      height: 32px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 0.9rem;
      transition: all 0.15s;
    }
    .btn-toggle-tree:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }
    .doc-breadcrumb {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.78rem;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .doc-breadcrumb strong {
      color: #fff;
      font-weight: 600;
    }
    .doc-breadcrumb .bc-badge {
      background: rgba(59, 130, 246, 0.15);
      border: 1px solid rgba(59, 130, 246, 0.35);
      color: #93c5fd;
      padding: 1px 6px;
      border-radius: 4px;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
    }
    /* Omni Search Bar */
    .doc-cmd-center {
      flex: 1;
      max-width: 520px;
      min-width: 200px;
    }
    .omni-search-box {
      position: relative;
      display: flex;
      align-items: center;
      width: 100%;
    }
    .omni-search-box input {
      width: 100%;
      height: 32px;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border-color);
      border-radius: 6px;
      padding: 0 32px 0 28px;
      color: #fff;
      font-size: 0.78rem;
      font-family: var(--font-sans);
      transition: all 0.2s;
    }
    .omni-search-box input:focus {
      outline: none;
      border-color: var(--brand-blue);
      background: rgba(0, 0, 0, 0.5);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    }
    .omni-search-box .icon-search {
      position: absolute;
      left: 8px;
      color: var(--text-muted);
      font-size: 0.75rem;
      pointer-events: none;
    }
    .omni-search-box .icon-clear {
      position: absolute;
      right: 8px;
      color: var(--text-muted);
      background: transparent;
      border: none;
      font-size: 0.75rem;
      cursor: pointer;
      display: none;
    }
    .omni-search-box .kbd-hint {
      position: absolute;
      right: 8px;
      font-family: var(--font-mono);
      font-size: 0.65rem;
      background: rgba(255, 255, 255, 0.08);
      padding: 1px 5px;
      border-radius: 3px;
      color: var(--text-muted);
      pointer-events: none;
    }
    .doc-cmd-right {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .view-toggle-grp {
      display: flex;
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border-color);
      border-radius: 6px;
      padding: 2px;
    }
    .view-toggle-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      padding: 3px 8px;
      font-size: 0.78rem;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .view-toggle-btn.active {
      background: rgba(59, 130, 246, 0.25);
      color: #93c5fd;
      font-weight: 600;
    }
    /* Micro Status KPI Filter Strip */
    .doc-status-strip {
      height: var(--strip-height);
      background: #090e1a;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      padding: 0 12px;
      gap: 6px;
      overflow-x: auto;
      flex-shrink: 0;
      white-space: nowrap;
    }
    .doc-status-strip::-webkit-scrollbar {
      height: 3px;
    }
    .doc-status-strip::-webkit-scrollbar-thumb {
      background: rgba(255,255,255,0.15);
    }
    .status-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 999px;
      padding: 2px 9px;
      font-size: 0.73rem;
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.15s ease;
      user-select: none;
    }
    .status-chip:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
    }
    .status-chip.active {
      background: rgba(59, 130, 246, 0.18);
      border-color: #3b82f6;
      color: #93c5fd;
      font-weight: 600;
    }
    .status-chip .chip-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
    }
    .dot-all { background: #94a3b8; }
    .dot-green { background: #10b981; }
    .dot-red { background: #ef4444; }
    .dot-yellow { background: #f59e0b; }
    .dot-gray { background: #64748b; }
    .status-chip .chip-count {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.72rem;
    }
    .chip-audit-score {
      margin-left: auto;
      background: rgba(59, 130, 246, 0.1);
      border: 1px solid rgba(59, 130, 246, 0.25);
      color: #93c5fd;
      border-radius: 6px;
      padding: 2px 8px;
      font-size: 0.72rem;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .filter-reset-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: rgba(239, 68, 68, 0.15);
      border: 1px solid rgba(239, 68, 68, 0.3);
      color: #fca5a5;
      padding: 2px 7px;
      border-radius: 999px;
      font-size: 0.7rem;
      cursor: pointer;
    }
    /* Main Workspace Multi-Pane Area */
    .doc-workspace {
      flex: 1;
      display: flex;
      min-height: 0;
      overflow: hidden;
      position: relative;
    }
    /* Left Pane: Tree & Facet Explorer */
    .doc-tree-explorer {
      width: var(--tree-width);
      background: var(--bg-tree);
      border-right: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
      overflow-y: auto;
      overflow-x: hidden;
      transition: width 0.2s ease;
      font-size: 0.75rem;
    }
    .doc-tree-explorer.collapsed {
      width: 0 !important;
      border-right: none;
    }
    .tree-section {
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      padding: 8px 0;
    }
    .tree-section-title {
      padding: 4px 12px 6px;
      font-size: 0.67rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .tree-nav-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 5px 12px;
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.12s;
      border-left: 2px solid transparent;
      user-select: none;
    }
    .tree-nav-item:hover {
      background: rgba(255, 255, 255, 0.04);
      color: #fff;
    }
    .tree-nav-item.active {
      background: rgba(59, 130, 246, 0.15);
      border-left-color: #3b82f6;
      color: #93c5fd;
      font-weight: 600;
    }
    .tree-nav-item .nav-left {
      display: flex;
      align-items: center;
      gap: 7px;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .tree-nav-item .nav-badge {
      font-family: var(--font-mono);
      font-size: 0.68rem;
      padding: 1px 5px;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.06);
      color: var(--text-muted);
    }
    .tree-nav-item.active .nav-badge {
      background: rgba(59, 130, 246, 0.25);
      color: #93c5fd;
    }
    .nav-badge-red {
      background: rgba(239, 68, 68, 0.2) !important;
      color: #f87171 !important;
      font-weight: 700;
    }
    .tree-chips-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      padding: 2px 12px;
    }
    .tree-pill {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border-color);
      border-radius: 4px;
      padding: 2px 7px;
      font-size: 0.72rem;
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.12s;
    }
    .tree-pill:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
    }
    .tree-pill.active {
      background: rgba(59, 130, 246, 0.2);
      border-color: #3b82f6;
      color: #93c5fd;
      font-weight: 600;
    }
    /* Center Pane: High-Density Document Grid */
    .doc-grid-pane {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
      background: var(--bg-grid);
      overflow: hidden;
    }
    .doc-table-wrap {
      flex: 1;
      min-height: 0;
      overflow: auto;
    }
    .doc-table-wrap::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    .doc-table-wrap::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.15);
      border-radius: 3px;
    }
    .doc-grid-table {
      width: 100%;
      min-width: 960px;
      table-layout: fixed;
      border-collapse: collapse;
      text-align: left;
      font-size: 0.76rem;
    }
    .doc-grid-table th {
      position: sticky;
      top: 0;
      background: #0d1527;
      color: #94a3b8;
      font-weight: 600;
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 7px 10px;
      border-bottom: 1px solid var(--border-color);
      white-space: nowrap;
      z-index: 5;
      user-select: none;
      position: relative;
    }
    .doc-grid-table th .th-text {
      display: inline-block;
      overflow: hidden;
      text-overflow: ellipsis;
      vertical-align: middle;
      max-width: calc(100% - 10px);
    }
    .col-resizer {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 7px;
      cursor: col-resize;
      user-select: none;
      z-index: 10;
      transition: background 0.12s;
    }
    .col-resizer:hover,
    .col-resizer.is-resizing {
      background: #3b82f6 !important;
      box-shadow: 0 0 6px rgba(59, 130, 246, 0.7);
    }
    body.is-resizing-col {
      cursor: col-resize !important;
      user-select: none !important;
    }
    .doc-grid-table td {
      padding: 6px 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      color: var(--text-primary);
      vertical-align: middle;
      overflow: hidden;
    }
    .doc-grid-table tr {
      transition: background 0.1s;
      cursor: pointer;
    }
    .doc-grid-table tr:hover {
      background: rgba(255, 255, 255, 0.035);
    }
    .doc-grid-table tr.active {
      background: rgba(59, 130, 246, 0.14) !important;
      border-left: 3px solid #3b82f6;
    }
    .cell-code {
      font-family: var(--font-mono);
      font-weight: 700;
      color: #60a5fa;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .cell-title {
      font-weight: 500;
      line-height: 1.35;
      color: #f1f5f9;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      word-break: break-word;
      white-space: normal;
    }
    .cell-subtitle {
      font-size: 0.7rem;
      color: var(--text-muted);
      margin-top: 2px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .cell-date {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: #94a3b8;
      white-space: nowrap;
    }
    .cell-partner-name {
      font-size: 0.73rem;
      color: #cbd5e1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
    }
    .tag-project {
      display: block;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      background: rgba(139, 92, 246, 0.15);
      border: 1px solid rgba(139, 92, 246, 0.3);
      color: #c4b5fd;
      border-radius: 4px;
      padding: 1px 6px;
      font-size: 0.68rem;
    }
    /* Badges */
    .badge-sig {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 0.68rem;
      font-weight: 600;
      white-space: nowrap;
    }
    .badge-sig-executed { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
    .badge-sig-unsigned { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
    .badge-sig-draft { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
    .badge-ocr {
      font-family: var(--font-mono);
      font-size: 0.67rem;
      padding: 1px 5px;
      border-radius: 4px;
      font-weight: 700;
      white-space: nowrap;
    }
    .badge-ocr-high { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
    .badge-ocr-medium { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
    .badge-ocr-quarantine { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); animation: pulseRed 2s infinite; }
    @keyframes pulseRed { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
    /* Pagination Bar */
    .doc-pagination-bar {
      height: 38px;
      background: #090e1a;
      border-top: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 12px;
      font-size: 0.73rem;
      color: var(--text-muted);
      flex-shrink: 0;
    }
    .pagination-controls {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .page-btn {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-color);
      color: var(--text-secondary);
      min-width: 26px;
      height: 26px;
      padding: 0 6px;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      transition: all 0.1s;
    }
    .page-btn:hover:not(:disabled) {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }
    .page-btn.active {
      background: var(--brand-blue);
      border-color: var(--brand-blue);
      color: #fff;
      font-weight: 700;
    }
    .page-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
    .page-size-select {
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid var(--border-color);
      color: var(--text-secondary);
      border-radius: 4px;
      padding: 3px 6px;
      font-size: 0.72rem;
    }
    /* Right Pane: Slide-over Drawer / Docked Detail Panel */
    .doc-detail-pane {
      width: 440px;
      background: var(--bg-panel);
      border-left: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
      min-height: 0;
      overflow: hidden;
      transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.2s;
    }
    .doc-detail-pane.drawer-mode {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 480px;
      z-index: 50;
      box-shadow: -15px 0 35px rgba(0, 0, 0, 0.6);
      transform: translateX(100%);
    }
    .doc-detail-pane.drawer-mode.open {
      transform: translateX(0);
    }
    .doc-detail-pane.hidden-pane {
      display: none;
    }
    .detail-header-strip {
      height: 38px;
      background: #090e1a;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 12px;
      flex-shrink: 0;
    }
    .detail-header-title {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: #94a3b8;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .btn-close-pane {
      background: transparent;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 1.1rem;
      padding: 2px 6px;
      border-radius: 4px;
    }
    .btn-close-pane:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
    }
    .detail-scroll-wrap {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
    }
    .detail-scroll-wrap::-webkit-scrollbar {
      width: 5px;
    }
    .detail-scroll-wrap::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.15);
      border-radius: 2px;
    }
    /* Modal Styling */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.82);
      backdrop-filter: blur(8px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 14px;
    }
    .modal-box {
      background: #111827;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      width: 100%;
      max-width: 650px;
      max-height: 90vh;
      overflow-y: auto;
      padding: 18px;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    }
    .modal-box-large {
      max-width: 1240px;
      width: 96vw;
      height: 90vh;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
    }
    .input-field {
      width: 100%;
      min-height: 34px;
      padding: 5px 9px;
      border: 1px solid var(--border-color);
      border-radius: 6px;
      font-size: 0.82rem;
      color: var(--text-primary);
      background: #0f172a;
      font-family: var(--font-sans);
    }
    .input-field:focus {
      outline: 2px solid var(--brand-blue);
      border-color: var(--brand-blue);
    }
    /* Micro Animations */
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes pulseGlow {
      0%, 100% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.25); border-color: rgba(59, 130, 246, 0.4); }
      50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); border-color: rgba(96, 165, 250, 0.8); }
    }
    @keyframes indeterminateBar {
      0% { transform: translateX(-100%); }
      50% { transform: translateX(30%); }
      100% { transform: translateX(100%); }
    }
    .loader-spin {
      width: 14px;
      height: 14px;
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-top-color: #3b82f6;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      display: inline-block;
    }
    /* Toast System */
    .toast-container {
      position: fixed;
      bottom: 20px;
      right: 20px;
      z-index: 10000;
      display: flex;
      flex-direction: column;
      gap: 6px;
      pointer-events: none;
    }
    .toast-msg {
      background: #1e293b;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 6px;
      padding: 8px 14px;
      color: #fff;
      font-size: 0.78rem;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
      display: flex;
      align-items: center;
      gap: 6px;
      pointer-events: auto;
      animation: toastIn 0.2s ease-out;
      transition: opacity 0.3s ease;
    }
    @keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
    .toast-success { border-color: rgba(16, 185, 129, 0.5); background: rgba(6, 78, 59, 0.95); color: #6ee7b7; }
    .toast-info { border-color: rgba(59, 130, 246, 0.5); background: rgba(30, 58, 138, 0.95); color: #93c5fd; }
    .toast-error { border-color: rgba(239, 68, 68, 0.5); background: rgba(127, 29, 29, 0.95); color: #fca5a5; }
    @media (max-width: 900px) {
      .doc-tree-explorer { position: absolute; left: 0; top: 0; bottom: 0; z-index: 40; box-shadow: 10px 0 25px rgba(0,0,0,0.7); }
      .doc-tree-explorer.collapsed { display: none; }
      .doc-detail-pane { position: absolute; right: 0; top: 0; bottom: 0; width: 100% !important; z-index: 50; }
    }
