/*
 * app.css — ProspectIQ design tokens and component styles.
 * Carried over from the original SPA's inline <style> block, reorganised
 * into this standalone stylesheet so it can be cached by the browser and
 * edited independently of markup. Class names (kanban-card, badge-status,
 * status-In-Discussion, etc.) are unchanged from the original, so templates
 * that used to be rendered client-side map onto this CSS without changes.
 */

  :root {
    --brand-primary: #0000ff;
    --brand-blue-light: #3049ff;
    --brand-blue-dark: #16246d;

    --brand-secondary: #fff400;
    --brand-yellow-light: #ffe13c;
    --brand-yellow-dark: #ffce00;

    --brand-dark: #25292d;
    --brand-light: #efefe5;

    --sidebar-width: 240px;
    --sidebar-bg: var(--brand-primary);
    --sidebar-text: var(--brand-light);
    --sidebar-active: var(--brand-secondary);
    --sidebar-hover: var(--brand-secondary);
    --sidebar-border: rgba(255,255,255,0.3);

    --header-bg: #ffffff;
    --body-bg: #F6F9FA;
    --card-bg: #ffffff;
    
    --accent: #3b82f6;
    --accent-soft: #eff6ff;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --priority-high: #ef4444;
    --priority-med: #f59e0b;
    --priority-low: #3b82f6;

    --bs-border-color-translucent: rgba(0, 0, 0, 0.1);
  }

  body { background: var(--body-bg); font-family: 'Inter', system-ui, -apple-system, sans-serif; overflow-x: hidden; }
  
  /* SIDEBAR */
  #sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width);
    z-index: 1000; display: flex; flex-direction: column;
    transition: transform .3s;
    background: linear-gradient(135deg,#0000ff 40%,#16246d 100%);
    color: var(--brand-light);
  }
  .sidebar-brand {
    padding: 0.5rem 1rem;
    color: var(--brand-light);
    /* border-bottom: 1px solid var(--sidebar-border); */
    box-shadow: 0 0.075rem 1.5rem rgba(18, 38, 63, 0.15);
  }
  .sidebar-brand .brand-icon {
    display: block;
    text-align: center;
  }
  .sidebar-brand .brand-icon img {
    height: 39px; 
    display: block;
    margin: 0 auto;
  }

  .sidebar-user {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sidebar-border);
  }
  .user-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--brand-secondary);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--brand-dark); font-size: 11px; font-weight: 700;
    border: 0 none;
  }
  .user-name {font-size: 14px; }

  #sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }
  .nav-section-label {
    color: var(--brand-light); font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
    padding: 10px 20px 4px; font-weight: 600;
  }
  .nav-item-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px; color: var(--sidebar-text); text-decoration: none;
    font-size: 13.5px; border-radius: 0; transition: all .15s; cursor: pointer;
    border-left: 3px solid transparent;
  }
  .nav-item-link:hover { color: var(--sidebar-hover);}
  .nav-item-link.active { color: var(--sidebar-active);}
  .nav-item-link i { font-size: 16px; width: 20px; }
  .nav-badge { margin-left: auto; background: var(--danger); color: white; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }

  /* MAIN */
  #main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

  #header {
    background: var(--header-bg); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 58px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
  }
  .header-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
  .header-subtitle { font-size: 12px; color: var(--text-muted); }
  .header-subtitle .badge-status {font-size: 10px; padding: 2px 6px;}

  #content { padding: 24px; flex: 1; }

  /* KPI CARDS */
  .kpi-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 18px 20px; position: relative; overflow: hidden;
  }
  .kpi-card .kpi-icon {
    width: 40px; height: 40px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
    margin-bottom: 12px;
  }
  .kpi-number { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; }
  .kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
  .kpi-trend { font-size: 11px; margin-top: 6px; }

  /* CARDS */
  .panel-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  }
  .panel-card-header {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .panel-card-header h6 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-primary); }
  .panel-card-body { padding: 0; }

  /* PRIORITY STARS */
  .priority-star { color: #d1d5db; font-size: 12px; }
  .priority-star.filled { color: #f59e0b; }

  /* STATUS BADGES */
  .badge-status { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 20px; }
  .status-New { background: #f1f5f9; color: #475569; }
  .status-Researching { background: #fef9c3; color: #92400e; }
  .status-Contacted { background: #dbeafe; color: #1e40af; }
  .status-In-Discussion { background: #d1fae5; color: #065f46; }
  .status-Awaiting-Response { background: #fde8d8; color: #9a3412; }
  .status-Suitable { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
  .status-Declined { background: #fee2e2; color: #7f1d1d; }

  /* PROGRAMME BADGES */
  .badge-prog {
    font-size: 10px; padding: 2px 7px; border-radius: 20px; font-weight: 500;
    background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
    white-space: nowrap;
    margin-right: 0.3rem;
  }

  /* TAGIFY (Partnership Opportunities tag input) */
  .tagify { --tag-bg: #eff6ff; --tag-text-color: #1d4ed8; --tag-border-radius: 20px; --tag-pad: 3px 10px; font-size: 13px; border-radius: 8px; border-color: var(--border); }
  .tagify__tag > div::before { box-shadow: 0 0 0 1.1em #bfdbfe inset; }
  .tagify__tag__removeBtn { color: #1d4ed8; }
  .tagify__dropdown__item { font-size: 13px; }
  .tagify__dropdown__item--active { background: var(--accent-soft); color: var(--accent); }

  /* TIMELINE */
  .timeline.is-dashboard {
    padding: 1rem 1rem 1rem 40px !important;
  }
  .timeline.is-dashboard::before {
    left: 22px !important;
  }
  .timeline { position: relative; padding: 0 0 0 28px; }
  .timeline::before {
    content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
    width: 2px; background: var(--border);
  }
  .timeline-item { position: relative; margin-bottom: 20px; }
  .timeline-dot {
    position: absolute; left: -24px; top: 4px;
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid white;
    background: var(--accent); box-shadow: 0 0 0 2px var(--accent);
  }
  .timeline-card {
    background: white; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  }
  .timeline-meta { font-size: 11px; color: var(--text-muted); }
  .timeline-notes { font-size: 13px; margin: 6px 0 0; color: var(--text-primary); }

  /* TABLES */
  .prospect-table { font-size: 13px; }
  .prospect-table thead th {
    background: #f8fafc; border-bottom: 2px solid var(--border);
    color: var(--text-muted); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600; padding: 10px 12px; cursor: pointer;
    white-space: nowrap;
  }
  .prospect-table thead th:hover { color: var(--text-primary); }
  .prospect-table thead th i { font-size: 10px; }
  .prospect-table tbody tr { cursor: pointer; }
  .prospect-table tbody tr:hover { background: #f8fafc; }
  .prospect-table tbody td { padding: 10px 12px; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }

  /* ATTENTION ITEMS */
  .attention-item {
    display: flex; align-items: start; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid #f1f5f9;
  }
  .attention-item:last-child { border-bottom: none; }
  .attention-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; margin-top: 1px; }

  /* FOLLOWUP ITEMS */
  .followup-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid #f1f5f9; cursor: pointer;
  }
  .followup-item:hover { background: #f8fafc; }
  .followup-item:last-child { border-bottom: none; }

  /* COMPANY DETAIL */
  #companyDetail { display: none; }
  .detail-back { display: flex; align-items: center; gap: 6px; color: var(--accent); cursor: pointer; font-size: 13px; margin-bottom: 16px; }
  .detail-back:hover { text-decoration: underline; }
  .info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
  .info-value { font-size: 13.5px; color: var(--text-primary); font-weight: 500; }

  /* SEARCH */
  .search-input { border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
  .filter-select { border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }

  /* REPORTS */
  .chart-wrap { position: relative; height: 220px; }

  /* SETTINGS */
  .setting-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: #f1f5f9; border: 1px solid var(--border); border-radius: 20px;
    padding: 3px 10px; font-size: 12px; color: var(--text-primary); margin: 3px;
  }
  .setting-tag .remove-tag { cursor: pointer; color: var(--text-muted); font-size: 14px; line-height: 1; }
  .setting-tag .remove-tag:hover { color: var(--danger); }

  /* OVERDUE */
  .overdue-badge { background: #fee2e2; color: #b91c1c; }
  .today-badge { background: #fef9c3; color: #b45309; }
  .week-badge { background: #dbeafe; color: #1d4ed8; }

  /* TOASTS */
  .toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }

  /* AVATAR INITIALS */
  .avatar-sm {
    width: 26px; height: 26px; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: white;
  }

  /* PAGINATION */
  .page-link { font-size: 13px; }

  /* SECTION DIVIDER */
  .section-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); padding: 6px 14px; background: #f8fafc;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  }

  /* PROGRESS */
  .progress { height: 6px; border-radius: 4px; }

  /* MODAL */
  .modal-header { border-bottom: 1px solid var(--border); }
  .modal-footer { border-top: 1px solid var(--border); }

  /* ANIMATE IN */
  .fade-in { animation: fadeIn .2s ease; }
  @keyframes fadeIn { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform:none; } }

  .sortable-asc::after { content: ' ↑'; }
  .sortable-desc::after { content: ' ↓'; }

  /* Empty state */
  .empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
  .empty-state i { font-size: 40px; opacity: .3; margin-bottom: 10px; display: block; }

  /* Priority badge */
  .priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  .p-high { background: var(--priority-high); }
  .p-med { background: var(--priority-med); }
  .p-low { background: var(--priority-low); }
  .p-none { background: #d1d5db; }

  @media (max-width:768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: none; }
    #main { margin-left: 0; }
  }

  /* COMPANY OFFCANVAS */
  #companyOffcanvas {
    width: 85% !important;
    max-width: 100%;
  }
  .offcanvas-header {
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    background: var(--sidebar-bg);
    color: white;
  }
  .offcanvas-header .btn-close { filter: invert(1); }
  .oc-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
  .oc-subheader {
    padding: 10px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  }
  .oc-scroll { flex: 1; overflow-y: auto; padding: 20px; }
  .oc-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    display: flex; align-items: center; gap: 8px;
  }

  /* Next action card */
  .next-action-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border-radius: 10px; padding: 14px 16px; color: white; margin-bottom: 16px;
  }
  .next-action-card .na-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; margin-bottom: 4px; }
  .next-action-card .na-text { font-size: 14px; font-weight: 600; }
  .next-action-card .na-date { font-size: 12px; margin-top: 4px; }
  .next-action-card .na-overdue { color: #fca5a5; }
  .next-action-card .na-ok { color: #6ee7b7; }

  /* Edit mode */
  .edit-field { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 13px; width: 100%; background: white; }
  .edit-field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }

  /* Reports tabs */
  .report-tabs .nav-link { font-size: 13px; color: var(--text-muted); padding: 8px 16px; border: none; border-bottom: 2px solid transparent; border-radius: 0; }
  .report-tabs .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
  .report-tabs { border-bottom: 1px solid var(--border); margin-bottom: 20px; }

  @media (max-width: 992px) {
    #companyOffcanvas { width: 100% !important; }
  }

  /* LEAD STATUS BADGES */
  .lead-newlead { background: #f1f5f9; color: #475569; }
  .lead-m1 { background: #dbeafe; color: #1e40af; }
  .lead-m2 { background: #e0e7ff; color: #3730a3; }
  .lead-final { background: #fef9c3; color: #92400e; }
  .lead-contract { background: #fde8d8; color: #9a3412; }
  .lead-converted { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }

  /* KANBAN BOARDS */
  .kanban-board {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px;
  }
  .kanban-column {
    background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
    min-width: 280px; max-width: 280px; flex-shrink: 0;
    display: flex; flex-direction: column;
    max-height: calc(100vh - 250px);
  }
  .kanban-column-header {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    color: var(--text-muted); flex-shrink: 0;
  }
  .kanban-column-count {
    background: white; border: 1px solid var(--border); border-radius: 20px;
    padding: 1px 9px; font-size: 11px; font-weight: 700; color: var(--text-primary);
  }
  .kanban-cards {
    flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column;
    gap: 8px; min-height: 60px;
  }
  .kanban-cards:empty::before {
      content: "\F1A1";
    font-family: "bootstrap-icons";
    display: block;
    text-align: center;
    font-size: co;
    color: var(--bs-gray-500);
    margin-top: 1rem;
  }
  .kanban-cards:empty::after {
    content: "No companies";
    display: block;
    text-align: center;
    font-size: 10px;
    color: var(--bs-gray-500);
    line-height: 1;
    margin: 0 0 1rem;
  }

  .kanban-card {
    background: white; border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(15,23,42,.04);
    transition: box-shadow .15s;
  }
  .kanban-card:hover { box-shadow: 0 2px 10px rgba(15,23,42,.09); border-color: #cbd5e1; }
  .kanban-card.sortable-ghost { opacity: .35; }
  .kanban-card.sortable-chosen { box-shadow: 0 4px 14px rgba(59,130,246,.25); }
  .kanban-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; cursor: pointer; }
  .kanban-card-title:hover { color: var(--accent); }
  .kanban-card-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
  .kanban-card-desc { font-size: 12px; color: var(--text-primary); margin-top: 4px; line-height: 1.4; }
  .kanban-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid #f1f5f9;
  }
  .kanban-stat-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }
  .kanban-stat-number { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1; }
  .kanban-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
  .kanban-empty { text-align: center; padding: 24px 10px; color: var(--text-muted); font-size: 12px; }
  .kanban-empty i { font-size: 24px; opacity: .3; display: block; margin-bottom: 6px; }


/*Override bootstrap*/
.btn.btn-primary {background-color: var(--brand-primary);}
.alert-dismissible .btn-close {
  padding: 1rem;
  font-size: 10px;
}
.alert {
  font-size: 14px;
  line-height: 1.3;
}

/* Company detail offcanvas (added for AJAX company panel) */
#companyOffcanvas {
    width: 80vw;
}
@media (max-width: 768px) {
    #companyOffcanvas {
        width: 100vw;
    }
}

.modal {
    z-index: 1075;
}
.modal-backdrop {
    z-index: 1070;
}
.font-size-10 {font-size: 10px;}
.font-size-12 {font-size: 12px;}
.font-size-14 {font-size: 14px;}
.font-size-16 {font-size: 16px;}
.text-center {text-align: center;}

.btn-outline-light {border-color: #fff;}
.btn-outline-success {border-color: var(--bs-success);}
.btn-outline-danger {border-color: var(--bs-danger);}
.btn-outline-warning {border-color: var(--bs-warning);}
.btn-outline-info {border-color: var(--bs-info);}