  :root {
    --teal: #D4005E;
    --teal-light: #FF4482;
    --teal-dark: #1A0610;
    --teal-faint: #FDEEF5;
    --gold: #F59E0B;
    --gold-light: #FEF3C7;
    --bg: #F7F8FA;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #111827;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;
    --red: #EF4444;
    --red-light: #FEF2F2;
    --green: #10B981;
    --green-light: #ECFDF5;
    --blue: #3B82F6;
    --blue-light: #EFF6FF;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --radius: 10px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  
  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
  }

  /* SIDEBAR */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 220px;
    background: linear-gradient(180deg, #5C0020 0%, #D4005E 55%, #FF4482 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
  }

  .sidebar-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    overflow: visible;
  }

  .sidebar-logo .wordmark {
    font-family: 'DM Serif Display', serif;
    font-size: 18px;
    color: #fff;
    line-height: 1.2;
  }

  .sidebar-logo .tagline {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 3px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .nav-section {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 12px 8px 6px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: rgba(255,255,255,0.65);
    font-size: 13.5px;
    font-weight: 400;
    transition: all 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }

  .nav-item:hover { background: rgba(0,0,0,0.15); color: #fff; }
  .nav-item.active { background: rgba(0,0,0,0.25); color: #fff; font-weight: 500; }
  .nav-item .icon { font-size: 16px; opacity: 0.9; }

  .sidebar-stats {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .stat-pill {
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }

  .stat-pill .label { font-size: 11px; color: rgba(255,255,255,0.5); }
  .stat-pill .value { font-size: 14px; font-weight: 600; color: #fff; }

  /* MAIN */
  .main {
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* TOP BAR */
  .topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .topbar-title {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--teal-dark);
  }

  .topbar-actions { display: flex; gap: 10px; align-items: center; }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
  }

  .btn-primary {
    background: var(--teal);
    color: white;
  }
  .btn-primary:hover { background: var(--teal-light); }

  .btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
  }
  .btn-secondary:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-faint); }

  .btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 10px;
  }
  .btn-ghost:hover { color: var(--teal); background: var(--teal-faint); }

  /* CONTENT */
  .content { padding: 28px 32px; flex: 1; }

  /* PAGES */
  .page { display: none; }
  .page.active { display: block; }

  /* ========= DASHBOARD ========= */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
  }

  .stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
  }

  .stat-card .stat-number {
    font-family: 'DM Serif Display', serif;
    font-size: 32px;
    color: var(--teal-dark);
    line-height: 1;
  }

  .stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
  }

  .card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .card-title {
    font-weight: 600;
    font-size: 14px;
  }

  .card-body { padding: 16px 20px; }

  /* RFI LIST */
  .rfi-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
  }
  .rfi-item:last-child { border-bottom: none; }
  .rfi-item:hover { background: var(--bg); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }

  .rfi-icon {
    width: 38px; height: 38px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
  }

  .rfi-info { flex: 1; min-width: 0; }
  .rfi-name { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rfi-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
  }

  .badge-draft { background: #F3F4F6; color: #6B7280; }
  .badge-active { background: var(--blue-light); color: var(--blue); }
  .badge-review { background: var(--gold-light); color: #D97706; }
  .badge-submitted { background: var(--green-light); color: var(--green); }
  .badge-won { background: var(--teal-faint); color: var(--teal-dark); }
  .badge-lost { background: var(--red-light); color: var(--red); }

  .category-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
  }

  .cat-security { background: #EDE9FE; color: #7C3AED; }
  .cat-clinical { background: #DCFCE7; color: #16A34A; }
  .cat-tech { background: #DBEAFE; color: #2563EB; }
  .cat-company { background: var(--gold-light); color: #B45309; }
  .cat-team { background: #FCE7F3; color: #BE185D; }

  /* ========= LIBRARY ========= */
  .library-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .search-wrap {
    flex: 1;
    min-width: 250px;
    position: relative;
  }

  .search-wrap input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    background: var(--surface);
    transition: border-color 0.15s;
    outline: none;
  }

  .search-wrap input:focus { border-color: var(--teal); }
  .search-wrap .search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
  }

  .filter-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .filter-tab {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    transition: all 0.15s;
  }
  .filter-tab:hover { border-color: var(--teal); color: var(--teal); }
  .filter-tab.active { background: var(--teal); color: white; border-color: var(--teal); }

  .library-results {
    display: grid;
    gap: 10px;
  }

  .qa-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s;
  }
  .qa-card:hover { box-shadow: var(--shadow-md); }

  .qa-card-header {
    padding: 14px 16px 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
  }

  .qa-question {
    flex: 1;
    font-weight: 500;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
  }

  .qa-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
  }

  .source-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--teal-faint);
    color: var(--teal-dark);
    letter-spacing: 0.04em;
  }

  .qa-answer-wrap {
    display: none;
    padding: 0 16px 14px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }
  .qa-answer-wrap.open { display: block; }

  .qa-answer {
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    padding-top: 12px;
  }

  .qa-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }

  /* ========= RFI TRACKER ========= */
  .tracker-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
  }

  .rfi-table {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  .rfi-table table {
    width: 100%;
    border-collapse: collapse;
  }

  .rfi-table th {
    background: var(--bg);
    padding: 11px 16px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
  }

  .rfi-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
  }

  .rfi-table tr:last-child td { border-bottom: none; }
  .rfi-table tr:hover td { background: var(--bg); cursor: pointer; }

  .progress-bar-wrap {
    height: 5px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    width: 80px;
  }

  .progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--teal);
    transition: width 0.3s;
  }

  /* ========= AI ASSISTANT ========= */
  .ai-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    height: calc(100vh - 120px);
  }

  .chat-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeUp 0.2s ease;
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .chat-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
  }

  .avatar-user { background: var(--teal-faint); }
  .avatar-ai { background: var(--teal-dark); }

  .chat-bubble {
    max-width: calc(100% - 80px);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.65;
  }

  .bubble-user {
    background: var(--teal-dark);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
  }

  .bubble-ai {
    background: var(--bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
  }

  .chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
  }

  .chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.15s;
  }
  .chat-input-area textarea:focus { border-color: var(--teal); }

  .suggested-panel {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-y: auto;
  }

  .suggested-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
  }
  .suggested-item:last-child { border-bottom: none; }
  .suggested-item:hover { background: var(--teal-faint); }

  .suggested-item .s-question {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
  }

  .suggested-item .s-answer {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* MODAL */
  .modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }

  .modal {
    background: var(--surface);
    border-radius: 14px;
    width: 600px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
  }

  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
  }

  .modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .modal-title {
    font-family: 'DM Serif Display', serif;
    font-size: 18px;
    color: var(--teal-dark);
  }

  .modal-body { padding: 20px 24px; }
  .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
  }

  .form-group { margin-bottom: 16px; }
  .form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
  }

  .form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.15s;
    background: var(--surface);
  }
  .form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--teal); }
  .form-textarea { resize: vertical; min-height: 80px; }
  .section-row { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
  .section-row .section-header { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
  .section-row .section-name-input { flex:1; background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:5px 9px; font-size:13px; color:var(--text); }
  .section-row .section-name-input:focus { outline:none; border-color:var(--teal); }
  .section-row .remove-section-btn { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:16px; padding:0 4px; line-height:1; }
  .section-row .remove-section-btn:hover { color:#ef4444; }
  .assignee-chips { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
  .assignee-chip { display:inline-flex; align-items:center; gap:4px; background:rgba(20,184,166,0.12); color:var(--teal); border-radius:20px; padding:3px 10px 3px 10px; font-size:12px; font-weight:500; }
  .assignee-chip button { background:none; border:none; color:var(--teal); cursor:pointer; padding:0; font-size:13px; line-height:1; opacity:0.7; }
  .assignee-chip button:hover { opacity:1; }
  .add-assignee-wrap { display:flex; gap:6px; margin-top:6px; }
  .add-assignee-wrap input { flex:1; background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:4px 9px; font-size:12px; color:var(--text); }
  .add-assignee-wrap input:focus { outline:none; border-color:var(--teal); }
  .add-assignee-btn { background:var(--teal); color:#fff; border:none; border-radius:6px; padding:4px 10px; font-size:12px; cursor:pointer; }

  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

  /* EMPTY STATE */
  .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
  }
  .empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
  .empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
  .empty-state .empty-sub { font-size: 13px; }

  /* TOAST */
  .toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .toast {
    background: var(--teal-dark);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.2s ease;
  }

  @keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

  .thinking {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 0;
  }

  .thinking span {
    width: 7px; height: 7px;
    background: var(--teal);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
  }
  .thinking span:nth-child(2) { animation-delay: 0.2s; }
  .thinking span:nth-child(3) { animation-delay: 0.4s; }

  @keyframes bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
  }

  .divider { height: 1px; background: var(--border); margin: 16px 0; }

  .highlight { background: #FEF9C3; padding: 1px 2px; border-radius: 2px; }

  /* BULK PROCESSING */
  .bulk-modal { max-width: 780px; width: 95vw; }
  .bulk-question-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .bulk-question-row:last-child { border-bottom: none; }
  .bulk-q-text { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
  .bulk-answer-box {
    font-size: 13px;
    color: var(--text);
    line-height: 1.55;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    min-height: 60px;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .bulk-processing-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .bulk-progress-wrap {
    background: var(--border);
    border-radius: 20px;
    height: 6px;
    width: 100%;
    margin: 12px 0;
    overflow: hidden;
  }
  .bulk-progress-fill {
    height: 100%;
    background: var(--teal);
    border-radius: 20px;
    transition: width 0.3s ease;
  }
  .rfi-detail-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
  }
  .rfi-answers-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  .rfi-answers-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
  }
  .rfi-answers-table td {
    padding: 10px 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
  }
  .rfi-answers-table tr:last-child td { border-bottom: none; }
  .conf-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
  }
  .copy-ans-btn {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    white-space: nowrap;
  }
  .copy-ans-btn:hover { background: var(--teal); color: white; border-color: var(--teal); }
  .export-btn { margin-left: 8px; }
  .export-dropdown { position: relative; display: inline-block; margin-left: 8px; }
  .export-dropdown-menu {
    display: none; position: absolute; bottom: calc(100% + 6px); right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: var(--shadow-md); min-width: 180px; z-index: 9999; overflow: hidden;
  }
  .export-dropdown.open .export-dropdown-menu { display: block; }
  .export-dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 14px; font-size: 13px; font-family: inherit;
    background: none; border: none; cursor: pointer; color: var(--text);
    text-align: left; transition: background 0.15s;
  }
  .export-dropdown-menu button:hover { background: var(--teal-faint); color: var(--teal-dark); }
  .export-dropdown-menu button .export-icon { font-size: 16px; width: 20px; text-align: center; }
  .export-dropdown-divider { height: 1px; background: var(--border); margin: 2px 0; }
