    :root {
      --bg: #f7f8fa;
      --surface: #ffffff;
      --border: #e2e6ed;
      --text: #1a1d23;
      --text-secondary: #6b7280;
      --primary: #2563eb;
      --primary-hover: #1d4ed8;
      --status-contact: #f59e0b;
      --status-contact-bg: #fef3c7;
      --status-relation: #10b981;
      --status-relation-bg: #d1fae5;
      --status-later: #8b5cf6;
      --status-later-bg: #ede9fe;
      --status-rejected: #ef4444;
      --status-rejected-bg: #fee2e2;
      --status-qualifier: #06b6d4;
      --status-qualifier-bg: #cffafe;
      --status-qualifiee-df: #0891b2;
      --status-qualifiee-df-bg: #a5f3fc;
      --radius: 8px;
      --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
      --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    body {
      font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.5;
    }

    /* SIDEBAR */
    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      width: 220px;
      height: 100vh;
      background: var(--surface);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      z-index: 150;
      padding: 20px 0;
      transition: transform 0.25s ease;
    }

    .sidebar.collapsed {
      transform: translateX(-220px);
    }

    .sidebar-toggle {
      position: fixed;
      top: 16px;
      left: 224px;
      width: 28px;
      height: 28px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      z-index: 160;
      color: var(--text-secondary);
      transition: all 0.25s ease;
      box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    .sidebar-toggle:hover {
      color: var(--text);
      background: #f3f4f6;
    }

    .sidebar-toggle svg {
      width: 16px;
      height: 16px;
      transition: transform 0.25s ease;
    }

    .sidebar.collapsed ~ .sidebar-toggle {
      left: 12px;
    }

    .sidebar.collapsed ~ .sidebar-toggle svg {
      transform: rotate(180deg);
    }

    .sidebar.collapsed ~ .app-wrapper {
      margin-left: 0;
    }

    .sidebar-logo {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0 20px;
      margin-bottom: 28px;
      text-decoration: none;
      color: var(--text);
    }

    .sidebar-logo .logo-icon {
      width: 54px;
      height: 54px;
      min-width: 54px;
    }
    .sidebar-logo .logo-icon img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .sidebar-logo span {
      font-size: 17px;
      font-weight: 700;
    }

    .global-search-wrap {
      padding: 0 14px;
      margin-bottom: 16px;
      position: relative;
    }
    .global-search-wrap input {
      width: 100%;
      padding: 8px 12px 8px 32px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 13px;
      background: var(--bg);
      color: var(--text);
      outline: none;
      transition: border-color 0.2s;
      box-sizing: border-box;
    }
    .global-search-wrap input:focus {
      border-color: var(--primary);
    }
    .global-search-wrap .search-icon {
      position: absolute;
      left: 24px;
      top: 50%;
      transform: translateY(-50%);
      width: 14px;
      height: 14px;
      color: var(--text-secondary);
      pointer-events: none;
    }
    .global-search-results {
      position: absolute;
      top: 100%;
      left: 14px;
      right: 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.12);
      max-height: 420px;
      overflow-y: auto;
      z-index: 200;
      display: none;
      margin-top: 4px;
    }
    .global-search-results.visible { display: block; }
    .gsr-section-title {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-secondary);
      padding: 10px 14px 4px;
    }
    .gsr-item {
      display: flex;
      flex-direction: column;
      padding: 8px 14px;
      cursor: pointer;
      border-bottom: 1px solid var(--border);
      transition: background 0.15s;
    }
    .gsr-item:last-child { border-bottom: none; }
    .gsr-item:hover { background: #f3f4f6; }
    .gsr-item-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .gsr-item-sub {
      font-size: 11px;
      color: var(--text-secondary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 2px;
    }
    .gsr-empty {
      padding: 16px 14px;
      font-size: 13px;
      color: var(--text-secondary);
      text-align: center;
    }

    .sidebar-nav {
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding: 0 10px;
    }

    .sidebar-nav a {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 8px;
      text-decoration: none;
      color: var(--text-secondary);
      font-size: 14px;
      font-weight: 500;
      transition: all 0.15s;
    }

    .sidebar-nav a:hover {
      background: #f3f4f6;
      color: var(--text);
    }

    .sidebar-nav a.active {
      background: #eff6ff;
      color: var(--primary);
    }

    .sidebar-nav a svg {
      width: 18px;
      height: 18px;
      min-width: 18px;
    }

    /* Collapsible nav groups */
    .nav-group {}
    .nav-group-header {
      display: flex;
      align-items: center;
      cursor: pointer;
    }
    .nav-group-header a {
      flex: 1;
    }
    .nav-group-toggle {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      border: none;
      background: none;
      cursor: pointer;
      color: var(--text-secondary);
      border-radius: 4px;
      margin-right: 4px;
      transition: transform 0.2s, background 0.15s;
      flex-shrink: 0;
    }
    .nav-group-toggle:hover { background: #e5e7eb; }
    .nav-group-toggle svg { width: 14px; height: 14px; }
    .nav-group-toggle.collapsed { transform: rotate(-90deg); }
    .nav-group-children {
      overflow: hidden;
      transition: max-height 0.25s ease;
      max-height: 400px;
    }
    .nav-group-children.collapsed {
      max-height: 0;
    }
    .nav-group-children a {
      padding-left: 36px !important;
      font-size: 13px !important;
    }

    .app-wrapper {
      margin-left: 220px;
      transition: margin-left 0.25s ease;
    }

    /* HEADER */
    header {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 0 32px 0 48px;
      height: 64px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .logo {
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: 20px;
      font-weight: 700;
      color: var(--text);
    }

    .logo-icon {
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: 800;
    }

    .logo span {
      color: var(--text-secondary);
      font-weight: 400;
      font-size: 14px;
      margin-left: 4px;
    }

    .header-actions {
      display: flex;
      gap: 10px;
    }

    /* NOTIFICATIONS */
    .notif-wrap {
      position: relative;
      margin-left: 8px;
    }
    .notif-btn {
      width: 36px; height: 36px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: var(--surface);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer;
      position: relative;
      transition: background 0.15s;
      color: var(--text-secondary);
    }
    .notif-btn:hover { background: #f3f4f6; color: var(--text-primary); }
    .notif-btn svg { width: 18px; height: 18px; }
    .notif-badge {
      position: absolute; top: -2px; right: -2px;
      background: #ef4444; color: white;
      font-size: 10px; font-weight: 700;
      min-width: 18px; height: 18px;
      border-radius: 9px;
      display: flex; align-items: center; justify-content: center;
      padding: 0 4px;
      border: 2px solid var(--surface);
      line-height: 1;
    }
    .notif-badge:empty, .notif-badge[data-count="0"] { display: none; }
    .notif-dropdown {
      display: none;
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: var(--surface);
      border-radius: 12px;
      box-shadow: 0 8px 30px rgba(0,0,0,0.15);
      width: 380px;
      max-height: 480px;
      overflow-y: auto;
      z-index: 1000;
    }
    .notif-dropdown.open { display: block; }
    .notif-header {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
    }
    .notif-header h4 { font-size: 14px; font-weight: 600; margin: 0; }
    .notif-group-title {
      font-size: 11px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.5px; padding: 10px 16px 4px;
      color: var(--text-secondary);
    }
    .notif-item {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 16px; cursor: pointer;
      border-bottom: 1px solid var(--border);
      transition: background 0.1s;
    }
    .notif-item:last-child { border-bottom: none; }
    .notif-item:hover { background: #f9fafb; }
    .notif-dot {
      width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    }
    .notif-item-content { flex: 1; min-width: 0; }
    .notif-item-title {
      font-size: 13px; font-weight: 500; color: var(--text-primary);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .notif-item-sub {
      font-size: 11px; color: var(--text-secondary);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .notif-item-days {
      font-size: 12px; font-weight: 600; flex-shrink: 0;
    }
    .notif-empty {
      padding: 24px 16px; text-align: center;
      font-size: 13px; color: var(--text-secondary);
    }

    /* USER ACCOUNT MENU */
    .user-account {
      position: relative;
      margin-left: 8px;
    }
    .user-avatar {
      width: 36px; height: 36px;
      border-radius: 50%;
      background: var(--primary);
      color: white;
      display: flex; align-items: center; justify-content: center;
      font-size: 14px; font-weight: 600;
      cursor: pointer;
      transition: box-shadow 0.15s;
      border: 2px solid transparent;
    }
    .user-avatar:hover {
      box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
    }
    .user-avatar.open {
      border-color: var(--primary);
    }
    .user-dropdown {
      display: none;
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: white;
      border-radius: 12px;
      box-shadow: 0 8px 30px rgba(0,0,0,0.15);
      min-width: 260px;
      z-index: 1000;
      overflow: hidden;
    }
    .user-dropdown.open { display: block; }
    .user-dropdown-header {
      padding: 16px;
      border-bottom: 1px solid #e5e7eb;
      background: #f9fafb;
    }
    .user-dropdown-header .name {
      font-weight: 600; font-size: 14px; color: var(--text-primary);
    }
    .user-dropdown-header .role {
      font-size: 12px; color: var(--text-secondary); margin-top: 2px;
    }
    .user-dropdown-item {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 16px;
      font-size: 13px; color: var(--text-primary);
      cursor: pointer;
      transition: background 0.1s;
      border: none; background: none; width: 100%; text-align: left;
    }
    .user-dropdown-item:hover { background: #f3f4f6; }
    .user-dropdown-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
    .user-dropdown-item.danger { color: #ef4444; }
    .user-dropdown-item.danger:hover { background: #fef2f2; }
    .user-dropdown-divider { height: 1px; background: #e5e7eb; }

    /* PASSWORD CHANGE MODAL */
    .pwd-modal-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.4); z-index: 2000;
      align-items: center; justify-content: center;
    }
    .pwd-modal-overlay.open { display: flex; }
    .pwd-modal {
      background: white; border-radius: 16px;
      padding: 28px; width: 400px; max-width: 90vw;
      box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    }
    .pwd-modal h3 { margin: 0 0 20px; font-size: 18px; }
    .pwd-modal label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; margin-top: 14px; }
    .pwd-modal input {
      width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
      border-radius: 8px; font-size: 14px; box-sizing: border-box;
    }
    .pwd-modal input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
    .pwd-modal .pwd-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
    .pwd-modal .pwd-msg { font-size: 12px; margin-top: 10px; padding: 8px 12px; border-radius: 8px; display: none; }
    .pwd-modal .pwd-msg.error { display: block; background: #fef2f2; color: #ef4444; }
    .pwd-modal .pwd-msg.success { display: block; background: #f0fdf4; color: #16a34a; }

    /* BUTTONS */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      border-radius: var(--radius);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text);
      transition: all 0.15s ease;
    }

    .btn:hover { background: #f3f4f6; }

    .btn-primary {
      background: var(--primary);
      color: white;
      border-color: var(--primary);
    }

    .btn-primary:hover { background: var(--primary-hover); }

    .btn svg { width: 16px; height: 16px; }

    /* MAIN CONTENT */
    main {
      padding: 24px 32px;
    }

    .toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
    }

    .toolbar h2 {
      font-size: 22px;
      font-weight: 600;
    }

    .toolbar-right {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .search-box {
      position: relative;
    }

    .search-box input {
      padding: 8px 12px 8px 34px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      width: 240px;
      outline: none;
      transition: border 0.15s;
    }

    .search-box input:focus { border-color: var(--primary); }

    .search-box svg {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      width: 16px;
      height: 16px;
      color: var(--text-secondary);
    }

    /* TABLE */
    .table-container {
      background: var(--surface);
      border-radius: 12px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
      overflow-x: auto;
      overflow-y: auto;
      max-height: calc(100vh - 220px);
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }
    #viewEntreprises table {
      table-layout: fixed;
    }

    thead {
      background: #f9fafb;
    }

    thead th {
      position: sticky;
      top: 0;
      background: #f9fafb;
      z-index: 10;
    }

    /* Frozen checkbox + société columns */
    #viewEntreprises table th.select-col,
    #viewEntreprises table td.select-col {
      position: sticky;
      left: 0;
      z-index: 11;
      background: #fff;
    }
    #viewEntreprises table thead th.select-col {
      z-index: 12;
      background: #f9fafb;
    }
    #viewEntreprises table th.col-frozen,
    #viewEntreprises table td.col-frozen {
      position: sticky;
      z-index: 11;
      background: #fff;
      border-right: 2px solid var(--border);
    }
    #viewEntreprises table thead th.col-frozen {
      z-index: 12;
      background: #f9fafb;
    }
    tr:hover td.col-frozen,
    tr:hover td.select-col { background: #f9fafb; }
    tr.selected-row td.col-frozen,
    tr.selected-row td.select-col { background: #eff6ff; }

    th {
      padding: 12px 16px;
      text-align: left;
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
      cursor: pointer;
      user-select: none;
      transition: color 0.15s;
      position: relative;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    th:hover { color: var(--text); }

    th .sort-icon {
      display: inline-block;
      width: 14px;
      margin-left: 4px;
      opacity: 0.3;
      vertical-align: middle;
    }

    th.sorted .sort-icon { opacity: 1; }
    th.sorted { color: var(--primary); }

    /* Column resize handle */
    .col-resize-handle {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 5px;
      cursor: col-resize;
      background: transparent;
      z-index: 5;
    }
    .col-resize-handle:hover,
    .col-resize-handle.resizing {
      background: var(--primary);
      opacity: 0.4;
    }

    td {
      padding: 14px 16px;
      font-size: 14px;
      border-bottom: 1px solid #f3f4f6;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 0;
    }

    tr:last-child td { border-bottom: none; }

    tr:hover { background: #f9fafb; }

    .company-name {
      color: var(--primary);
      font-weight: 600;
      cursor: pointer;
      text-decoration: none;
    }

    .company-name:hover { text-decoration: underline; }

    /* STATUS BADGES */
    .status-badge, .select-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
    }

    .score-badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 10px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
      letter-spacing: 0.3px;
    }

    .status-badge::before {
      content: '';
      width: 6px;
      height: 6px;
      border-radius: 50%;
    }

    .select-badge-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .status-a-contacter {
      background: var(--status-contact-bg);
      color: #92400e;
    }
    .status-a-contacter::before { background: var(--status-contact); }

    .status-en-relation {
      background: var(--status-relation-bg);
      color: #065f46;
    }
    .status-en-relation::before { background: var(--status-relation); }

    .status-a-recontacter {
      background: var(--status-later-bg);
      color: #5b21b6;
    }
    .status-a-recontacter::before { background: var(--status-later); }

    .status-rejete {
      background: var(--status-rejected-bg);
      color: #991b1b;
    }
    .status-rejete::before { background: var(--status-rejected); }

    .status-a-qualifier {
      background: var(--status-qualifier-bg);
      color: #155e75;
    }
    .status-a-qualifier::before { background: var(--status-qualifier); }

    .status-qualifiee-df {
      background: var(--status-qualifiee-df-bg);
      color: #0e7490;
    }
    .status-qualifiee-df::before { background: var(--status-qualifiee-df); }

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

    .modal-overlay.active { display: flex; }

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

    @keyframes modalIn {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 28px;
      position: sticky;
      top: 0;
      background: var(--surface);
      z-index: 10;
      border-bottom: 1px solid var(--border);
      gap: 12px;
    }

    .modal-header h2 {
      font-size: 20px;
      font-weight: 700;
      white-space: nowrap;
      flex-shrink: 1;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .modal-header-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-shrink: 0;
    }

    .modal-close {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      border: none;
      background: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-secondary);
      font-size: 20px;
    }

    .modal-close:hover { background: #f3f4f6; }

    .modal-body {
      padding: 20px 28px 28px;
    }

    .detail-section {
      margin-bottom: 28px;
    }

    .detail-section h3 {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 14px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }

    .detail-grid {
      padding-bottom: 8px;
    }

    .detail-grid-section {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 14px 24px;
      overflow-x: auto;
    }

    .detail-grid-divider {
      border: none;
      border-top: 1px solid var(--border);
      margin: 16px 0;
    }

    .detail-card {
      background: #f9fafb;
      border-radius: var(--radius);
      padding: 14px 18px;
      margin-top: 12px;
    }
    .detail-card label {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 4px;
      display: block;
    }
    .detail-card .value {
      font-size: 14px;
      color: var(--text-primary);
      line-height: 1.5;
    }

    .detail-field {
      min-width: 0;
    }

    .detail-field label {
      display: block;
      font-size: 12px;
      color: var(--text-secondary);
      margin-bottom: 4px;
    }

    .detail-field .value {
      font-size: 14px;
      font-weight: 500;
    }

    /* HISTORY */
    .history-list {
      display: flex;
      flex-direction: column;
      gap: 0;
    }

    .history-item {
      display: flex;
      gap: 14px;
      padding: 12px 0;
      position: relative;
    }

    .history-item:not(:last-child)::after {
      content: '';
      position: absolute;
      left: 15px;
      top: 36px;
      bottom: -2px;
      width: 2px;
      background: var(--border);
    }

    .history-dot {
      width: 32px;
      height: 32px;
      min-width: 32px;
      border-radius: 50%;
      background: #eff6ff;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--primary);
      font-size: 14px;
      z-index: 1;
    }

    .history-content {
      flex: 1;
    }

    .history-content .date {
      font-size: 12px;
      color: var(--text-secondary);
    }
    .history-content > .date { display: none; } /* replaced by inline date */

    .history-content .note {
      font-size: 13px;
      margin-top: 6px;
      white-space: pre-wrap;
      word-break: break-word;
      line-height: 1.5;
      background: #f9fafb;
      border: 1px solid #f0f0f0;
      border-radius: 8px;
      padding: 10px 14px;
      color: var(--text-primary);
    }
    .history-content .note.truncated {
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .history-content .note-toggle {
      display: inline-block;
      margin-top: 4px;
      font-size: 12px;
      color: var(--primary);
      cursor: pointer;
      font-weight: 500;
      background: none;
      border: none;
      padding: 0;
      font-family: inherit;
    }
    .history-content .note-toggle:hover { text-decoration: underline; }

    /* HISTORY EDIT MODE */
    .history-item .history-actions {
      display: inline-flex;
      gap: 4px;
      align-items: center;
      flex-shrink: 0;
    }

    .history-action-btn {
      width: 28px;
      height: 28px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--surface);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-secondary);
      transition: all 0.15s;
      padding: 0;
    }

    .history-action-btn:hover {
      background: #f3f4f6;
      color: var(--text);
    }

    .history-action-btn.delete-btn:hover {
      background: #fef2f2;
      color: #ef4444;
      border-color: #fecaca;
    }

    .history-action-btn.save-btn:hover {
      background: #f0fdf4;
      color: #16a34a;
      border-color: #bbf7d0;
    }

    .history-action-btn svg {
      width: 14px;
      height: 14px;
    }

    .history-edit-input {
      width: 100%;
      padding: 8px 12px;
      border: 1.5px solid var(--primary);
      border-radius: var(--radius);
      font-size: 13px;
      font-family: inherit;
      outline: none;
      margin-top: 4px;
      background: #f8faff;
      resize: vertical;
      line-height: 1.5;
    }

    .history-edit-input:focus {
      box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }

    .history-item.editing {
      background: #f8faff;
      margin: 0 -12px;
      padding: 12px;
      border-radius: 8px;
    }

    /* EDIT MODE */
    .edit-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      margin-top: 16px;
      padding-top: 16px;
      border-top: 1px solid var(--border);
    }

    .btn-danger {
      background: #ef4444;
      color: white;
      border-color: #ef4444;
    }

    .btn-danger:hover { background: #dc2626; }

    .btn-success {
      background: #10b981;
      color: white;
      border-color: #10b981;
    }

    .btn-success:hover { background: #059669; }

    .detail-field input,
    .detail-field select {
      padding: 6px 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      outline: none;
      width: 100%;
      font-family: inherit;
    }

    .detail-field input:focus,
    .detail-field select:focus {
      border-color: var(--primary);
    }

    .header-with-btn {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .header-with-btn h3 {
      border-bottom: none;
      padding-bottom: 0;
      margin-bottom: 0;
    }

    /* ADD HISTORY FORM */
    .add-history {
      display: flex;
      gap: 8px;
      margin-top: 16px;
      padding-top: 16px;
      border-top: 1px solid var(--border);
    }

    .add-history input, .add-history textarea {
      flex: 1;
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      outline: none;
    }

    .add-history input:focus, .add-history textarea:focus { border-color: var(--primary); }

    /* CSV MODAL */
    .csv-modal {
      width: 480px;
    }

    /* ADD COMPANY MODAL */
    .add-modal {
      width: 560px;
    }

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

    .form-field {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .form-field.full { grid-column: 1 / -1; }

    .form-field label {
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
    }

    .form-field input,
    .form-field select,
    .form-field textarea {
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      outline: none;
      font-family: inherit;
    }

    .form-field input:focus,
    .form-field select:focus,
    .form-field textarea:focus {
      border-color: var(--primary);
    }

    .form-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 20px;
    }

    /* ACTIVITY BUTTONS */
    .activity-buttons {
      display: flex;
      gap: 10px;
      margin-bottom: 18px;
    }

    .activity-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      padding: 10px 16px;
      border: 1.5px solid var(--border);
      border-radius: 10px;
      background: var(--surface);
      cursor: pointer;
      transition: all 0.15s ease;
      font-family: inherit;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-secondary);
      min-width: 72px;
    }

    .activity-btn:hover {
      border-color: var(--primary);
      color: var(--primary);
      background: #eff6ff;
    }

    .activity-btn svg { width: 22px; height: 22px; }

    .activity-btn.linkedin:hover { border-color: #0077b5; color: #0077b5; background: #f0f7fc; }
    .activity-btn.mail-btn:hover { border-color: #ea4335; color: #ea4335; background: #fef2f2; }
    .activity-btn.call-btn:hover { border-color: #16a34a; color: #16a34a; background: #f0fdf4; }
    .activity-btn.meeting-btn:hover { border-color: #8b5cf6; color: #8b5cf6; background: #f5f3ff; }

    .history-item .history-dot.dot-linkedin { background: #e8f4fd; color: #0077b5; }
    .history-item .history-dot.dot-mail { background: #fef2f2; color: #ea4335; }
    .history-item .history-dot.dot-call { background: #f0fdf4; color: #16a34a; }
    .history-item .history-dot.dot-meeting { background: #f5f3ff; color: #8b5cf6; }
    .history-item .history-dot.dot-note { background: #eff6ff; color: var(--primary); }

    .history-type {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 1px;
    }

    .history-topline {
      display: flex;
      align-items: center;
      gap: 0;
      flex-wrap: nowrap;
      width: 100%;
    }

    .history-topline .history-meta {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 1;
      min-width: 0;
    }

    .history-topline .history-meta .sep {
      color: #d1d5db;
      font-size: 11px;
    }

    .history-topline .history-meta .date-inline {
      font-size: 12px;
      color: var(--text-secondary);
      white-space: nowrap;
    }

    .history-topline .history-right {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-left: auto;
      flex-shrink: 0;
    }

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

    .activity-modal-overlay.active { display: flex; }

    .activity-modal {
      background: var(--surface);
      border-radius: 14px;
      padding: 24px;
      width: 420px;
      max-width: 90vw;
      box-shadow: var(--shadow-lg);
      animation: modalIn 0.2s ease;
    }

    .activity-modal h3 {
      font-size: 16px;
      margin-bottom: 14px;
    }

    .activity-modal textarea {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      font-family: inherit;
      resize: vertical;
      min-height: 80px;
      outline: none;
    }

    .activity-modal textarea:focus { border-color: var(--primary); }

    .activity-modal .form-actions {
      margin-top: 14px;
    }

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

    .rejection-modal-overlay.active { display: flex; }

    .rejection-modal {
      background: var(--surface);
      border-radius: 14px;
      padding: 24px;
      width: 420px;
      max-width: 90vw;
      box-shadow: var(--shadow-lg);
      animation: modalIn 0.2s ease;
    }

    .rejection-modal h3 {
      font-size: 16px;
      margin-bottom: 6px;
    }

    .rejection-modal p {
      font-size: 13px;
      color: var(--text-secondary);
      margin-bottom: 14px;
    }

    .rejection-modal input {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      font-family: inherit;
      outline: none;
    }

    .rejection-modal input:focus { border-color: var(--primary); }

    .rejection-modal .form-actions {
      margin-top: 14px;
    }

    /* EMPTY STATE */
    .empty-state {
      text-align: center;
      padding: 48px;
      color: var(--text-secondary);
    }

    /* FILE INPUT HIDDEN */
    #csvFileInput { display: none; }
    #csvActionsFileInput { display: none; }

    /* VIEW TABS */
    .view-tabs {
      display: flex;
      gap: 0;
      border-bottom: 2px solid var(--border);
      margin-bottom: 20px;
    }

    .view-tab {
      padding: 10px 24px;
      font-size: 14px;
      font-weight: 600;
      color: var(--text-secondary);
      cursor: pointer;
      border: none;
      background: none;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      transition: all 0.15s;
      font-family: inherit;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .view-tab:hover {
      color: var(--text);
    }

    .view-tab.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
    }

    .view-tab svg {
      width: 16px;
      height: 16px;
    }

    .view-section {
      display: none;
    }

    .view-section.active {
      display: block;
    }

    /* ACTIONS TABLE */
    .actions-table td .note-preview {
      max-width: 300px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

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

    .actions-type-badge svg {
      width: 13px;
      height: 13px;
    }

    .type-linkedin { background: #e8f4fd; color: #0077b5; }
    .type-mail { background: #fef2f2; color: #ea4335; }
    .type-call { background: #f0fdf4; color: #16a34a; }
    .type-meeting { background: #f5f3ff; color: #8b5cf6; }
    .type-note { background: #eff6ff; color: var(--primary); }

    /* REPONSE CHECKBOX */
    .reponse-check {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: #10b981;
    }

    .reponse-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 12px;
    }

    .reponse-badge.oui {
      background: #d1fae5;
      color: #065f46;
    }

    .reponse-badge.non {
      background: #f3f4f6;
      color: #9ca3af;
    }

    .history-reponse {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.15s;
      user-select: none;
      white-space: nowrap;
    }

    .history-reponse.oui {
      background: #d1fae5;
      color: #065f46;
    }

    .history-reponse.non {
      background: #f3f4f6;
      color: #9ca3af;
      border: 1px dashed #d1d5db;
    }
    .history-reponse.non:hover {
      background: #e5e7eb;
      color: #6b7280;
    }
    .history-reponse.oui:hover {
      background: #a7f3d0;
    }

    .history-auteur {
      display: inline-flex;
      align-items: center;
      margin-left: 8px;
      font-size: 11px;
      font-weight: 500;
      padding: 1px 8px;
      border-radius: 10px;
      background: #e0e7ff;
      color: #3730a3;
      vertical-align: middle;
    }

    /* ======================== */
    /* CARTE (MAP) VIEW        */
    /* ======================== */
    .map-wrapper {
      display: flex;
      gap: 24px;
      min-height: 560px;
    }
    .map-svg-container {
      flex: 1;
      position: relative;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }
    #leafletMap {
      width: 100%;
      height: 600px;
      border-radius: var(--radius);
    }
    .leaflet-company-tooltip {
      background: #1a1d23 !important;
      color: #fff !important;
      border: none !important;
      border-radius: 6px !important;
      padding: 8px 12px !important;
      font-size: 12px !important;
      box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
      line-height: 1.4 !important;
    }
    .leaflet-company-tooltip::before {
      border-top-color: #1a1d23 !important;
    }

    /* Lieu autocomplete */
    .lieu-autocomplete-wrapper { position: relative; width: 100%; }
    .lieu-autocomplete-wrapper input { width: 100%; box-sizing: border-box; }
    .lieu-suggestions {
      position: absolute; top: 100%; left: 0; right: 0; z-index: 9999;
      background: #fff; border: 1px solid var(--border); border-top: none;
      border-radius: 0 0 8px 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
      max-height: 220px; overflow-y: auto; display: none;
    }
    .lieu-suggestions.visible { display: block; }
    .lieu-suggestion-item {
      padding: 9px 12px; cursor: pointer; font-size: 13px;
      display: flex; align-items: center; gap: 8px;
      border-bottom: 1px solid #f1f5f9; transition: background 0.1s;
    }
    .lieu-suggestion-item:last-child { border-bottom: none; }
    .lieu-suggestion-item:hover, .lieu-suggestion-item.active { background: #eff6ff; }
    .lieu-suggestion-item .lieu-icon { color: #6b7280; flex-shrink: 0; }
    .lieu-suggestion-item .lieu-city { font-weight: 500; color: #1a1d23; }
    .lieu-suggestion-item .lieu-context { color: #6b7280; font-size: 12px; margin-left: auto; }
    .map-legend {
      width: 260px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .map-legend-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px;
    }
    .map-legend-card h4 {
      font-size: 13px;
      font-weight: 600;
      margin: 0 0 12px;
      color: var(--text);
    }
    .map-legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 0;
      font-size: 13px;
    }
    .map-legend-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .map-legend-count {
      margin-left: auto;
      font-weight: 600;
      color: var(--text);
    }
    .map-legend-region {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 3px 0;
      font-size: 12px;
      color: var(--text-secondary);
      cursor: pointer;
    }
    .map-legend-region:hover { color: var(--primary); }
    .map-legend-region span:last-child {
      font-weight: 600;
      color: var(--text);
    }
    .map-unlocated {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--border);
    }
    .map-unlocated-item {
      font-size: 12px;
      color: var(--text-secondary);
      padding: 2px 0;
      cursor: pointer;
    }
    .map-unlocated-item:hover { color: var(--primary); }
    @media (max-width: 768px) {
      .map-wrapper { flex-direction: column; }
      .map-legend { width: 100%; }
    }

    /* ======================== */
    /* UPDATE MODAL            */
    /* ======================== */
    .update-field-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      margin-bottom: 8px;
      transition: background 0.15s, border-color 0.15s;
      cursor: pointer;
    }
    .update-field-row:hover { background: #f8fafc; }
    .update-field-row.selected { background: #eff6ff; border-color: var(--primary); }
    .update-field-row input[type="checkbox"] { flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
    .update-field-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; min-width: 100px; }
    .update-field-values { flex: 1; display: flex; gap: 12px; align-items: center; }
    .update-val-current { flex: 1; font-size: 13px; color: #6b7280; text-decoration: line-through; background: #fef2f2; padding: 4px 8px; border-radius: 4px; }
    .update-val-new { flex: 1; font-size: 13px; color: #065f46; font-weight: 500; background: #ecfdf5; padding: 4px 8px; border-radius: 4px; }
    .update-val-same { flex: 1; font-size: 13px; color: #6b7280; padding: 4px 8px; }
    .update-arrow { color: #9ca3af; font-size: 16px; flex-shrink: 0; }
    .update-search-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
    .update-search-item:hover { background: #eff6ff; border-color: var(--primary); }
    .update-search-item h4 { margin: 0 0 2px; font-size: 14px; }
    .update-search-item p { margin: 0; font-size: 12px; color: var(--text-secondary); }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ======================== */
    /* BDD SPREADSHEET VIEW    */
    /* ======================== */
    .bdd-spreadsheet-container {
      position: relative;
      background: var(--surface);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      overflow: auto;
      max-height: calc(100vh - 200px);
    }

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

    .bdd-table th {
      background: #f1f3f5;
      border: 1px solid #d1d5db;
      padding: 6px 10px;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      color: var(--text-secondary);
      position: sticky;
      top: 0;
      z-index: 10;
      white-space: nowrap;
      user-select: none;
      cursor: pointer;
    }

    .bdd-table th.sortable:hover {
      background: #e5e7eb;
    }

    .bdd-table th .bdd-sort-icon {
      margin-left: 4px;
      font-size: 10px;
      opacity: 0.3;
    }

    .bdd-table th.sorted .bdd-sort-icon {
      opacity: 1;
      color: var(--primary);
    }

    /* BDD Filter row */
    .bdd-table .bdd-filter-row td {
      background: #f9fafb;
      padding: 3px 4px;
      border: 1px solid #d1d5db;
      position: sticky;
      top: 33px;
      z-index: 9;
      cursor: default;
    }

    .bdd-filter-input {
      width: 100%;
      border: 1px solid #e5e7eb;
      border-radius: 4px;
      padding: 3px 6px;
      font-size: 11px;
      font-family: inherit;
      outline: none;
      background: #fff;
    }

    .bdd-filter-input:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
    }

    .bdd-filter-select {
      width: 100%;
      border: 1px solid #e5e7eb;
      border-radius: 4px;
      padding: 3px 4px;
      font-size: 11px;
      font-family: inherit;
      outline: none;
      background: #fff;
      cursor: pointer;
    }

    .bdd-filter-select:focus {
      border-color: var(--primary);
    }

    .bdd-active-filters {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--primary);
      font-weight: 500;
      margin-left: 12px;
    }

    .bdd-clear-filters {
      background: none;
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 2px 8px;
      font-size: 11px;
      cursor: pointer;
      color: var(--text-secondary);
    }

    .bdd-clear-filters:hover {
      background: #f3f4f6;
    }

    .bdd-table td {
      border: 1px solid #e5e7eb;
      padding: 4px 8px;
      font-size: 13px;
      height: 32px;
      cursor: cell;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 220px;
    }

    .bdd-table td.bdd-cell-editing {
      padding: 0;
      background: #fff;
      box-shadow: inset 0 0 0 2px var(--primary);
      z-index: 5;
      overflow: visible;
    }

    .bdd-table td.bdd-cell-editing input,
    .bdd-table td.bdd-cell-editing select {
      width: 100%;
      height: 100%;
      min-height: 30px;
      border: none;
      padding: 4px 8px;
      font-size: 13px;
      font-family: inherit;
      outline: none;
      background: transparent;
    }

    .bdd-table td.bdd-cell-selected {
      background: #dbeafe;
    }

    .bdd-table td.bdd-cell-readonly {
      background: #f9fafb;
      cursor: not-allowed;
    }

    .bdd-table .row-num {
      width: 40px;
      min-width: 40px;
      max-width: 40px;
      text-align: center;
      color: var(--text-secondary);
      background: #f9fafb;
      font-size: 11px;
      cursor: default;
    }

    .bdd-table .select-col {
      width: 32px;
      min-width: 32px;
      text-align: center;
    }

    .bdd-table tr:hover td {
      background: #f0f4ff;
    }
    .bdd-table tr:hover td.bdd-cell-selected {
      background: #bfdbfe;
    }
    .bdd-table tr:hover td.bdd-cell-editing {
      background: #fff;
    }

    /* BDD Lock Overlay */
    .bdd-lock-overlay {
      position: absolute;
      inset: 0;
      background: rgba(255,255,255,0.95);
      backdrop-filter: blur(6px);
      z-index: 20;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .bdd-lock-overlay.unlocked { display: none; }

    .bdd-lock-card {
      text-align: center;
      padding: 48px 40px;
      background: var(--surface);
      border-radius: 16px;
      box-shadow: var(--shadow-lg);
      max-width: 360px;
    }

    .bdd-lock-card svg.lock-icon {
      width: 48px;
      height: 48px;
      color: var(--text-secondary);
      margin-bottom: 16px;
    }

    .bdd-lock-card h3 {
      font-size: 18px;
      margin-bottom: 8px;
    }

    .bdd-lock-card p {
      font-size: 13px;
      color: var(--text-secondary);
      margin-bottom: 20px;
    }

    .bdd-lock-card input {
      width: 100%;
      padding: 10px 14px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 14px;
      font-family: inherit;
      outline: none;
      text-align: center;
      letter-spacing: 2px;
      margin-bottom: 12px;
    }

    .bdd-lock-card input:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }

    .bdd-lock-card .btn { width: 100%; }

    .bdd-error {
      color: #ef4444;
      font-size: 12px;
      margin-top: 8px;
    }

    /* BDD Toolbar */
    .bdd-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 0;
      gap: 12px;
    }

    .bdd-toolbar h2 {
      font-size: 18px;
      font-weight: 600;
    }

    .bdd-toolbar-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .bdd-toolbar .search-box {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 6px 12px;
    }

    .bdd-toolbar .search-box svg {
      width: 14px;
      height: 14px;
      color: var(--text-secondary);
    }

    .bdd-toolbar .search-box input {
      border: none;
      outline: none;
      font-size: 13px;
      font-family: inherit;
      width: 180px;
      background: transparent;
    }

    /* MULTI SELECT & SELECTION BAR */
    .select-check {
      width: 16px;
      height: 16px;
      cursor: pointer;
      accent-color: var(--primary);
    }

    th.select-col, td.select-col {
      width: 40px;
      text-align: center;
      padding-left: 12px;
      padding-right: 4px;
    }

    tr.selected-row {
      background: #eff6ff !important;
    }

    .selection-bar {
      display: none;
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--text);
      color: white;
      padding: 10px 20px;
      border-radius: 12px;
      box-shadow: 0 8px 30px rgba(0,0,0,0.2);
      z-index: 180;
      align-items: center;
      gap: 16px;
      font-size: 14px;
      font-weight: 500;
      animation: slideUp 0.2s ease;
    }

    .selection-bar.visible { display: flex; }

    @keyframes slideUp {
      from { opacity: 0; transform: translateX(-50%) translateY(10px); }
      to { opacity: 1; transform: translateX(-50%) translateY(0); }
    }

    .selection-bar .sel-count {
      white-space: nowrap;
    }

    .selection-bar button {
      background: #dc2626;
      color: white;
      border: none;
      padding: 6px 16px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      font-family: inherit;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: background 0.15s;
    }

    .selection-bar button:hover { background: #b91c1c; }

    .selection-bar .sel-cancel {
      background: transparent;
      color: white;
      border: 1px solid rgba(255,255,255,0.3);
      padding: 6px 12px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
      font-family: inherit;
    }

    .selection-bar .sel-cancel:hover { background: rgba(255,255,255,0.1); }

    /* CUSTOM SORT PANEL */
    .sort-panel-wrapper {
      position: relative;
    }

    .sort-panel {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow-lg);
      padding: 16px;
      z-index: 100;
      min-width: 380px;
    }

    .sort-panel.open { display: block; }

    .sort-panel h4 {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 12px;
    }

    .sort-rules {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 12px;
    }

    .sort-rule {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .sort-rule select {
      flex: 1;
      padding: 6px 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      font-family: inherit;
      outline: none;
      background: white;
    }

    .sort-rule select:focus { border-color: var(--primary); }

    .sort-rule .sort-dir {
      width: 100px;
      flex-shrink: 0;
    }

    .sort-rule .sort-remove {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-secondary);
      padding: 4px;
      border-radius: 4px;
      display: flex;
      align-items: center;
    }

    .sort-rule .sort-remove:hover { background: #fee2e2; color: #dc2626; }

    .sort-rule-label {
      font-size: 11px;
      color: var(--text-secondary);
      font-weight: 600;
      width: 50px;
      flex-shrink: 0;
    }

    .sort-panel-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .sort-add-btn {
      background: none;
      border: none;
      color: var(--primary);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      padding: 4px 0;
      font-family: inherit;
    }

    .sort-add-btn:hover { text-decoration: underline; }

    .sort-apply-btn {
      background: var(--primary);
      color: white;
      border: none;
      padding: 6px 14px;
      border-radius: var(--radius);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
    }

    .sort-apply-btn:hover { background: var(--primary-hover); }

    .sort-clear-btn {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-secondary);
      padding: 6px 12px;
      border-radius: var(--radius);
      font-size: 13px;
      cursor: pointer;
      font-family: inherit;
    }

    .sort-clear-btn:hover { background: #f3f4f6; }

    .btn.sort-active {
      background: #eff6ff;
      color: var(--primary);
      border-color: var(--primary);
    }

    /* CSV PREVIEW MODAL */
    .csv-preview-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.5);
      z-index: 300;
      justify-content: center;
      align-items: center;
      padding: 20px;
    }

    .csv-preview-overlay.active { display: flex; }

    .csv-preview-box {
      background: var(--surface);
      border-radius: 16px;
      width: 85vw;
      max-width: 1100px;
      max-height: 80vh;
      display: flex;
      flex-direction: column;
      box-shadow: var(--shadow-lg);
      animation: modalIn 0.2s ease;
    }

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

    .csv-preview-header h3 {
      font-size: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .csv-preview-header .csv-preview-count {
      font-size: 13px;
      color: var(--text-secondary);
      font-weight: 400;
    }

    .csv-preview-body {
      overflow: auto;
      flex: 1;
      padding: 0;
    }

    .csv-preview-body table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }

    .csv-preview-body thead {
      background: #f9fafb;
      position: sticky;
      top: 0;
      z-index: 2;
    }

    .csv-preview-body th {
      padding: 10px 14px;
      text-align: left;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase;
      white-space: nowrap;
      border-bottom: 1px solid var(--border);
    }

    .csv-preview-body td {
      padding: 8px 14px;
      border-bottom: 1px solid #f3f4f6;
      max-width: 250px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .csv-preview-body tr:hover { background: #f9fafb; }

    .csv-preview-footer {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 10px;
      padding: 14px 24px;
      border-top: 1px solid var(--border);
    }

    /* SETTINGS VIEW */
    .settings-tabs {
      display: flex;
      gap: 0;
      border-bottom: 2px solid var(--border);
      margin-bottom: 24px;
    }
    .settings-tab {
      padding: 10px 24px;
      font-size: 14px;
      font-weight: 500;
      color: var(--text-secondary);
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      cursor: pointer;
      transition: color 0.2s, border-color 0.2s;
    }
    .settings-tab:hover {
      color: var(--text-primary);
    }
    .settings-tab.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
      font-weight: 600;
    }
    .settings-tab-content {
      display: none;
    }
    .settings-tab-content.active {
      display: block;
    }

    .settings-section {
      max-width: 700px;
    }

    .settings-section h3 {
      font-size: 16px;
      margin-bottom: 16px;
      color: var(--text);
    }

    .column-list {
      list-style: none;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--surface);
      overflow: hidden;
    }

    .column-item {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      border-bottom: 1px solid #f3f4f6;
      background: var(--surface);
      transition: background 0.15s;
    }
    .column-item .select-options-editor { width: 100%; }

    .column-item:last-child { border-bottom: none; }

    .column-item:hover { background: #f9fafb; }

    .column-item.dragging {
      opacity: 0.5;
      background: #eff6ff;
    }

    .column-item.drag-over {
      border-top: 2px solid var(--primary);
    }

    .col-drag-handle {
      cursor: grab;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      flex-shrink: 0;
    }

    .col-drag-handle:active { cursor: grabbing; }

    .col-name {
      flex: 1;
      font-size: 14px;
      font-weight: 500;
    }

    .col-key {
      font-size: 12px;
      color: var(--text-secondary);
      background: #f3f4f6;
      padding: 2px 8px;
      border-radius: 4px;
      font-family: monospace;
    }

    .col-actions {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .col-actions button {
      background: none;
      border: none;
      cursor: pointer;
      padding: 4px;
      border-radius: 4px;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
    }

    .col-actions button:hover { background: #f3f4f6; color: var(--text); }

    .col-actions button.col-delete:hover { background: #fee2e2; color: #dc2626; }

    .col-core-badge {
      font-size: 10px;
      color: var(--text-secondary);
      background: #f3f4f6;
      padding: 2px 6px;
      border-radius: 4px;
    }

    .add-column-form {
      display: flex;
      gap: 8px;
      margin-top: 16px;
      align-items: flex-end;
    }

    .add-column-form .form-field {
      flex: 1;
    }

    .add-column-form label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
      margin-bottom: 4px;
    }

    .add-column-form input {
      width: 100%;
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      font-family: inherit;
      outline: none;
    }

    .add-column-form input:focus, .add-column-form select:focus { border-color: var(--primary); }

    .add-column-form select {
      width: 100%;
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      font-size: 13px;
      font-family: inherit;
      outline: none;
      background: white;
    }

    .col-type-badge {
      font-size: 10px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 4px;
      text-transform: uppercase;
    }

    .col-type-badge.type-text {
      background: #f3f4f6;
      color: #6b7280;
    }

    .col-type-badge.type-select {
      background: #ede9fe;
      color: #7c3aed;
    }

    .col-type-badge.type-date {
      background: #fef3c7;
      color: #d97706;
    }

    /* SELECT OPTIONS EDITOR */
    .select-options-editor {
      margin-top: 10px;
      padding: 12px 16px;
      background: #f9fafb;
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }

    .select-options-editor h5 {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 8px;
    }

    .select-option-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }

    .select-option-row input[type="text"] {
      flex: 1;
      padding: 5px 10px;
      border: 1px solid var(--border);
      border-radius: 6px;
      font-size: 13px;
      font-family: inherit;
      outline: none;
    }

    .select-option-row input[type="text"]:focus { border-color: var(--primary); }

    .select-option-row input[type="color"] {
      width: 28px;
      height: 28px;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 2px;
      cursor: pointer;
      background: white;
    }

    .select-option-row .opt-remove,
    .select-option-row .option-remove-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-secondary);
      padding: 3px;
      border-radius: 4px;
      display: flex;
      align-items: center;
    }

    .select-option-row .opt-remove:hover,
    .select-option-row .option-remove-btn:hover { background: #fee2e2; color: #dc2626; }

    .add-option-btn {
      background: none;
      border: none;
      color: var(--primary);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      padding: 4px 0;
      font-family: inherit;
      margin-top: 4px;
    }

    .add-option-btn:hover { text-decoration: underline; }

    /* RESPONSIVE */
    /* Owner Dashboard */
    .owner-dashboard { padding: 0; }
    .owner-header {
      display: flex; align-items: center; gap: 16px;
      margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
    }
    .owner-avatar {
      width: 48px; height: 48px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 22px; font-weight: 700; color: #fff;
    }
    .owner-header h2 { margin: 0; font-size: 22px; font-weight: 700; }
    .owner-header .owner-subtitle { font-size: 13px; color: var(--text-light); margin-top: 2px; }
    .owner-stats {
      display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px;
    }
    .owner-stat-card {
      background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
      padding: 14px 20px; min-width: 110px; text-align: center;
    }
    .owner-stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
    .owner-stat-card .stat-label { font-size: 11px; color: var(--text-light); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
    .owner-columns {
      display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px;
    }
    .owner-section {
      background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
      padding: 20px; margin-bottom: 20px; overflow: visible;
    }
    .owner-section h3 {
      font-size: 15px; font-weight: 600; margin: 0 0 14px 0;
      display: flex; align-items: center; gap: 8px;
    }
    .owner-section h3 .section-count {
      background: var(--primary); color: #fff; font-size: 11px;
      padding: 2px 8px; border-radius: 10px; font-weight: 600;
    }
    .owner-company-list { list-style: none; padding: 0; margin: 0; }
    .owner-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; max-width: 100%; }
    .owner-table th {
      text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 600;
      color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px;
      border-bottom: 2px solid var(--border); background: var(--bg-alt, #f9fafb);
      position: relative; overflow: hidden;
    }
    .owner-table .col-flex { width: auto; }
    .owner-table th .col-resize {
      position: absolute; right: 0; top: 0; bottom: 0; width: 5px;
      cursor: col-resize; background: transparent; z-index: 5;
    }
    .owner-table th .col-resize:hover, .owner-table th .col-resize.dragging { background: var(--primary); opacity: 0.4; }
    .owner-table td {
      padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .owner-table tr { cursor: pointer; transition: background 0.15s; }
    .owner-table tbody tr:hover { background: #f0f4ff; }
    .owner-table .company-name { font-weight: 500; color: var(--primary); }
    .owner-table .cell-truncate { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .owner-table .cell-compact { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-secondary); position: relative; cursor: default; }
    .owner-table .cell-compact .cell-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .owner-table .cell-compact .cell-tip { position: absolute; left: 0; bottom: 100%; margin-bottom: 4px; background: #1e293b; color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 12px; line-height: 1.5; white-space: normal; max-width: 320px; word-break: break-word; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.2); pointer-events: none; display: none; }
    .owner-table .cell-compact.overflowing:hover { overflow: visible; }
    .owner-table .cell-compact.overflowing:hover .cell-tip { display: block; }
    .owner-table .td-right { white-space: nowrap; font-size: 12px; text-align: right; padding-left: 4px; }
    .owner-action-list { list-style: none; padding: 0; margin: 0; }
    .owner-action-item {
      display: flex; align-items: flex-start; gap: 10px;
      padding: 8px 0; font-size: 13px;
    }
    .owner-action-item + .owner-action-item { border-top: 1px solid var(--border); }
    .owner-action-item .action-date { color: var(--text-light); font-size: 12px; white-space: nowrap; min-width: 80px; }
    .owner-action-item .action-type-badge {
      font-size: 11px; padding: 2px 8px; border-radius: 6px;
      background: #e0e7ff; color: #3730a3; font-weight: 500; white-space: nowrap;
    }
    .owner-action-item .action-company { font-weight: 500; cursor: pointer; color: var(--primary); }
    .owner-action-item .action-company:hover { text-decoration: underline; }
    .owner-action-item .action-note { color: var(--text-light); }
    .owner-empty { text-align: center; padding: 24px; color: var(--text-light); font-size: 13px; }

    @media (max-width: 768px) {
      header { padding: 0 16px; }
      main { padding: 16px; }
      .detail-field { min-width: 120px; }
      .form-grid { grid-template-columns: 1fr; }
      .modal { width: 95%; margin: 0 auto; }
      .search-box input { width: 160px; }
    }

    /* Login screen */
    .login-screen {
      position: fixed; inset: 0; z-index: 9999;
      background: var(--bg);
      display: flex; align-items: center; justify-content: center;
    }
    .login-screen.hidden { display: none; }
    .login-box {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 16px; padding: 40px; width: 360px;
      box-shadow: 0 8px 30px rgba(0,0,0,0.08); text-align: center;
    }
    .login-box .logo-icon {
      width: 72px; height: 72px; margin: 0 auto 16px;
    }
    .login-box .logo-icon img {
      width: 100%; height: 100%; object-fit: contain;
    }
    .login-box h2 { margin: 0 0 24px; font-size: 20px; }
    .login-box input {
      width: 100%; padding: 10px 14px; margin-bottom: 12px;
      border: 1px solid var(--border); border-radius: var(--radius);
      font-size: 14px; font-family: inherit; outline: none; box-sizing: border-box;
    }
    .login-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
    .login-box .btn-login {
      width: 100%; padding: 10px; background: var(--primary); color: white;
      border: none; border-radius: var(--radius); font-size: 14px;
      font-weight: 600; cursor: pointer; font-family: inherit; margin-top: 4px;
    }
    .login-box .btn-login:hover { background: #1d4ed8; }
    .login-error { color: #dc2626; font-size: 13px; margin-top: 12px; display: none; padding: 8px 12px; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius); }
    .password-wrapper { position: relative; width: 100%; }
    .password-wrapper input { width: 100%; padding-right: 40px; box-sizing: border-box; }
    .password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-secondary); display: flex; align-items: center; }
    .password-toggle:hover { color: var(--text-primary); }
    .password-toggle svg { width: 18px; height: 18px; }
    .app-loading {
      position: fixed; inset: 0; z-index: 9998;
      background: var(--bg);
      display: flex; align-items: center; justify-content: center;
      font-size: 14px; color: var(--text-secondary);
    }
    .app-loading.hidden { display: none; }

    /* DF DIRECT TABLE */
    .df-table-wrapper {
      overflow-x: auto;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: white;
    }
    .df-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    .df-table th {
      background: #f8fafc;
      padding: 8px 12px;
      text-align: center;
      font-weight: 600;
      font-size: 12px;
      color: var(--text-primary);
      border-bottom: 2px solid var(--border);
      white-space: nowrap;
      position: sticky;
      top: 0;
      z-index: 10;
    }
    .df-table th:first-child {
      text-align: left;
      min-width: 160px;
      background: #f1f5f9;
    }
    .df-table th.total-col {
      background: #eef2ff;
      color: var(--primary);
    }
    .df-table td {
      padding: 6px 12px;
      text-align: center;
      border-bottom: 1px solid #f1f5f9;
      vertical-align: top;
      font-size: 12px;
    }
    .df-table td:first-child {
      text-align: left;
      font-weight: 500;
      color: var(--text-secondary);
      font-size: 11px;
    }
    .df-table td.total-col {
      font-weight: 700;
      color: var(--primary);
      background: #fafbff;
    }
    .df-table tr.section-header td {
      background: #f8fafc;
      font-weight: 700;
      font-size: 11px;
      color: var(--text-primary);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      padding: 10px 12px 6px;
      border-bottom: 2px solid var(--border);
    }
    .df-table .big-num {
      font-size: 18px;
      font-weight: 700;
      color: var(--text-primary);
    }
    .df-table .company-list {
      font-size: 11px;
      color: var(--text-secondary);
      line-height: 1.6;
    }
    .df-table .company-list a {
      color: var(--primary);
      text-decoration: none;
      cursor: pointer;
    }
    .df-table .company-list a:hover {
      text-decoration: underline;
    }
    .df-table tr.total-row td {
      background: #f0f4ff;
      font-weight: 700;
      border-top: 2px solid var(--primary);
      font-size: 14px;
    }
    .df-owner-header {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .df-owner-dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    /* ========================
       PAGINATION
       ======================== */
    .pagination-bar {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 12px 16px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      border-radius: 0 0 12px 12px;
      user-select: none;
    }
    .pagination-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 36px;
      height: 36px;
      padding: 0 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface);
      color: var(--text);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .pagination-btn:hover:not([disabled]):not(.active) {
      background: var(--bg);
      border-color: var(--primary);
      color: var(--primary);
    }
    .pagination-btn.active {
      background: var(--primary);
      border-color: var(--primary);
      color: #fff;
      font-weight: 600;
    }
    .pagination-btn[disabled] {
      opacity: 0.35;
      cursor: not-allowed;
    }
    .pagination-ellipsis {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      color: var(--text-secondary);
      font-size: 14px;
    }
    .pagination-info {
      margin-left: 16px;
      font-size: 12px;
      color: var(--text-secondary);
    }
