  :root {
    --cvl-navy: #0E1727;
    --cvl-navy-2: #1a2638;
    --cvl-orange: #EF7E4B;
    --cvl-orange-dark: #d96a3a;
    --cvl-orange-light: rgba(239, 126, 75, 0.12);
    --cvl-blue: #7196CE;
    --cvl-blue-light: rgba(113, 150, 206, 0.15);
    --bg-page: #f5f6f8;
    --bg-card: #ffffff;
    --bg-secondary: #f1f3f6;
    --text-primary: #0E1727;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f0f1f3;
    --green: #10b981;
    --green-bg: #d1fae5;
    --green-text: #065f46;
    --amber: #f59e0b;
    --amber-bg: #fef3c7;
    --amber-text: #92400e;
    --red: #ef4444;
    --red-bg: #fee2e2;
    --red-text: #991b1b;
    --gray-bg: #f3f4f6;
    --gray-text: #4b5563;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
  }

  /* ============ LOGIN SCREEN ============ */
  .login-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--cvl-navy) 0%, var(--cvl-navy-2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  }
  .login-logo {
    text-align: center;
    margin-bottom: 28px;
  }
  .login-logo .brand {
    font-size: 26px;
    font-weight: 700;
    color: var(--cvl-navy);
    font-style: italic;
    letter-spacing: -0.5px;
  }
  .login-logo .brand .accent { color: var(--cvl-orange); font-weight: 400; }
  .login-logo .tagline {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
  }
  .form-group { margin-bottom: 16px; }
  .form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
  }
  .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: white;
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--cvl-orange);
    box-shadow: 0 0 0 3px var(--cvl-orange-light);
  }
  .btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .btn-primary { background: var(--cvl-orange); color: white; }
  .btn-primary:hover { background: var(--cvl-orange-dark); }
  .btn-secondary { background: white; color: var(--text-primary); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--bg-secondary); }
  .btn-block { width: 100%; justify-content: center; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }

  /* ============ APP LAYOUT ============ */
  /* Django : .app est toujours affiché (pas de SPA toggle comme dans le prototype) */
  .app { display: flex; min-height: 100vh; }
  /* Vision DG UX : sidebar fixe qui scrolle independamment du contenu */
  .app > .sidebar { flex-shrink: 0; }
  .app > .main-content, .app > .main { margin-left: 240px; flex: 1; min-width: 0; }
  .app.active { display: flex; }

  .sidebar {
    width: 240px;
    background: var(--cvl-navy);
    color: white;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    height: 100vh;
    position: fixed;      /* fixe la sidebar au viewport, scroll independant */
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    scrollbar-width: thin;
  }
  .sidebar::-webkit-scrollbar { width: 6px; }
  .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
  /* Vision DG UX : sections nav collapsibles avec chevron +/- */
  .nav-section {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 6px;
    transition: background 0.15s;
    border-radius: 4px;
  }
  .nav-section:hover { background: rgba(255,255,255,0.05); }
  .nav-section::after {
    content: '▼';
    font-size: 8px;
    opacity: 0.5;
    margin-left: 6px;
    transition: transform 0.2s;
  }
  .nav-section.collapsed::after { transform: rotate(-90deg); }
  .nav-item.hidden-collapsed { display: none !important; }
  .sidebar-brand {
    padding: 6px 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .sidebar-brand .logo-mark {
    width: 32px; height: 32px;
    background: var(--cvl-orange);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 14px;
  }
  .sidebar-brand .name {
    font-size: 14px; font-weight: 600; line-height: 1.2;
    font-style: italic;
  }
  .sidebar-brand .name .accent { color: var(--cvl-orange); font-weight: 400; }
  .sidebar-brand .tagline { font-size: 9px; color: rgba(255,255,255,0.5); margin-top: 2px; font-style: italic; }

  .nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 14px 12px 6px;
  }
  .nav-item {
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
  }
  .nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
  .nav-item.active { background: var(--cvl-orange-light); color: var(--cvl-orange); font-weight: 500; }
  .nav-item.sub { padding-left: 36px; font-size: 12px; }
  .nav-item .badge {
    margin-left: auto;
    font-size: 10px;
    background: rgba(239,126,75,0.2);
    color: var(--cvl-orange);
    padding: 2px 7px;
    border-radius: 8px;
    font-weight: 500;
  }
  .nav-item .badge.muted { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
  .nav-item svg { flex-shrink: 0; }

  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .topbar-left h1 { font-size: 18px; font-weight: 600; }
  .topbar-left .breadcrumb { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
  .topbar-right { display: flex; align-items: center; gap: 12px; }
  .search-box {
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    width: 240px;
    color: var(--text-primary);
  }
  .search-box:focus { outline: none; border-color: var(--cvl-orange); background: white; }
  .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--cvl-blue);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
  }
  .icon-btn {
    width: 32px; height: 32px;
    border-radius: 6px;
    background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    border: none;
  }
  .icon-btn:hover { background: var(--border); color: var(--text-primary); }

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

  /* ============ PAGE SECTIONS ============ */
  .page { display: none; }
  .page.active { display: block; }

  /* ============ KPI ============ */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
  }
  .kpi-card {
    background: white;
    border-radius: 10px;
    padding: 16px 18px;
    border-left: 3px solid var(--cvl-orange);
    border-top: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
  }
  .kpi-card.blue { border-left-color: var(--cvl-blue); }
  .kpi-card.green { border-left-color: var(--green); }
  .kpi-card.navy { border-left-color: var(--cvl-navy); }
  .kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .kpi-value {
    font-size: 28px;
    font-weight: 600;
    margin-top: 6px;
    color: var(--text-primary);
  }
  .kpi-trend {
    font-size: 11px;
    margin-top: 4px;
    color: var(--text-secondary);
  }
  .kpi-trend.up { color: var(--green-text); }
  .kpi-trend.warn { color: var(--amber-text); }

  /* ============ CARDS ============ */
  .card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
  }
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
  }
  .card-title { font-size: 15px; font-weight: 600; }
  .card-subtitle { font-size: 12px; color: var(--text-secondary); }

  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }

  /* ============ TRANSPORT CARDS ============ */
  .transport-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .transport-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .transport-card:hover { border-color: var(--cvl-orange); transform: translateY(-1px); }
  .transport-card.selected { border: 2px solid var(--cvl-orange); background: var(--cvl-orange-light); padding: 15px; }
  .transport-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .transport-icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
  }
  .transport-card.selected .transport-icon { background: var(--cvl-orange); color: white; }
  .transport-card.selected .transport-icon svg { fill: white; }

  /* ============ PROGRESS BARS ============ */
  .progress-row { margin-bottom: 12px; }
  .progress-row:last-child { margin-bottom: 0; }
  .progress-label {
    display: flex; justify-content: space-between;
    font-size: 12px; margin-bottom: 4px;
  }
  .progress-label .obj { color: var(--text-tertiary); font-weight: 400; }
  .progress-label .value { font-weight: 600; }
  .progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
  }
  .progress-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }
  .progress-fill.green { background: var(--green); }
  .progress-fill.orange { background: var(--cvl-orange); }
  .progress-fill.red { background: var(--red); }

  /* ============ TABLES ============ */
  .table-wrapper { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  thead th {
    background: var(--bg-secondary);
    text-align: left;
    padding: 10px 12px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  thead th:first-child { border-radius: 6px 0 0 6px; }
  thead th:last-child { border-radius: 0 6px 6px 0; }
  tbody td { padding: 12px; border-bottom: 1px solid var(--border-light); }
  tbody tr { cursor: pointer; transition: background 0.1s; }
  tbody tr:hover { background: var(--bg-secondary); }
  tbody tr:last-child td { border-bottom: none; }

  /* ============ BADGES & PILLS ============ */
  .pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
  }
  .pill.green { background: var(--green-bg); color: var(--green-text); }
  .pill.amber { background: var(--amber-bg); color: var(--amber-text); }
  .pill.red { background: var(--red-bg); color: var(--red-text); }
  .pill.gray { background: var(--gray-bg); color: var(--gray-text); }
  .pill.orange { background: var(--cvl-orange-light); color: var(--cvl-orange-dark); }
  .pill.blue { background: var(--cvl-blue-light); color: #2B5A95; }
  .pill.navy { background: rgba(15,23,39,0.08); color: var(--cvl-navy); }

  .avatar-sm {
    width: 28px; height: 28px;
    border-radius: 50%;
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    margin-right: 8px;
  }

  /* ============ FILTERS ============ */
  .filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
  .filter-pill {
    padding: 7px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
  }
  .filter-pill:hover { border-color: var(--cvl-orange); }
  .filter-pill.active { background: var(--cvl-orange); color: white; border-color: var(--cvl-orange); }

  /* ============ STEPS ============ */
  .steps { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
  .step {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
  }
  .step.active { background: var(--cvl-orange); color: white; font-weight: 500; }
  .step.done { background: var(--green-bg); color: var(--green-text); }

  /* ============ INFO BOX ============ */
  .info-box {
    padding: 12px 14px;
    background: var(--cvl-blue-light);
    border-left: 3px solid var(--cvl-blue);
    border-radius: 4px;
    font-size: 12px;
    margin-top: 14px;
  }
  .info-box strong { color: #185FA5; }

  /* ============ DONUT CHART ============ */
  .legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; }
  .legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

  /* ============ PERMISSION MATRIX ============ */
  .perm-table th, .perm-table td { text-align: center; }
  .perm-table th:first-child, .perm-table td:first-child { text-align: left; }
  .perm-cell {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .perm-cell.allowed { background: var(--green-bg); color: var(--green-text); }
  .perm-cell.denied { background: var(--gray-bg); color: var(--text-tertiary); }

  /* ============ MODAL ============ */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-overlay.active { display: flex; }
  .modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
  }
  .modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
  }
  .modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); }

  /* ============ ALERTS ============ */
  .alert-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-secondary);
    margin-bottom: 8px;
    font-size: 12px;
  }
  .alert-item.urgent { background: var(--red-bg); }
  .alert-item.warning { background: var(--amber-bg); }
  .alert-icon {
    width: 32px; height: 32px;
    border-radius: 6px;
    background: white;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  .text-orange { color: var(--cvl-orange); }
  .text-green { color: var(--green-text); }
  .text-red { color: var(--red); }
  .text-secondary { color: var(--text-secondary); }
  .text-xs { font-size: 11px; }
  .text-sm { font-size: 12px; }
  .mb-0 { margin-bottom: 0; }
  .mt-2 { margin-top: 8px; }
  .mt-4 { margin-top: 16px; }
  .flex { display: flex; }
  .flex-1 { flex: 1; }
  .gap-2 { gap: 8px; }
  .items-center { align-items: center; }
  .justify-end { justify-content: flex-end; }
  .text-right { text-align: right; }
  .font-medium { font-weight: 500; }
  .font-semibold { font-weight: 600; }

  /* Dark mode */
  body.dark-mode {
    --bg-page: #0a0f1c;
    --bg-card: #141d2e;
    --bg-secondary: #1c2740;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --border: #2a3548;
    --border-light: #1f2940;
    --green-bg: rgba(16, 185, 129, 0.15);
    --amber-bg: rgba(245, 158, 11, 0.15);
    --red-bg: rgba(239, 68, 68, 0.15);
    --gray-bg: rgba(156, 163, 175, 0.12);
  }
  body.dark-mode .login-card { background: #141d2e; color: #e5e7eb; }
  body.dark-mode .login-logo .brand,
  body.dark-mode .login-logo .brand span { color: #e5e7eb; }
  body.dark-mode .login-logo .brand .accent { color: var(--cvl-orange); }
  body.dark-mode .form-group input,
  body.dark-mode .form-group select,
  body.dark-mode .form-group textarea,
  body.dark-mode .search-box,
  body.dark-mode input,
  body.dark-mode select,
  body.dark-mode textarea { background: #1c2740; color: #e5e7eb; border-color: #2a3548; }
  body.dark-mode .filter-pill { background: #1c2740; color: #e5e7eb; border-color: #2a3548; }
  body.dark-mode .filter-pill:hover { border-color: var(--cvl-orange); }
  body.dark-mode .filter-pill.active { background: var(--cvl-orange); color: white; }
  body.dark-mode .btn-secondary { background: #1c2740; color: #e5e7eb; border-color: #2a3548; }
  body.dark-mode .btn-secondary:hover { background: #243349; }
  body.dark-mode thead th { background: #1c2740; color: #9ca3af; }
  body.dark-mode tbody tr:hover { background: #1c2740; }
  body.dark-mode .icon-btn { background: #1c2740; color: #9ca3af; }
  body.dark-mode .icon-btn:hover { background: #2a3548; color: #e5e7eb; }
  body.dark-mode .modal { background: #141d2e; color: #e5e7eb; }
  body.dark-mode .topbar { background: #141d2e; border-bottom-color: #2a3548; }
  body.dark-mode .info-box { background: rgba(113, 150, 206, 0.12); }
  body.dark-mode .pill.green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
  body.dark-mode .pill.amber { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
  body.dark-mode .pill.red { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
  body.dark-mode .pill.gray { background: rgba(156, 163, 175, 0.18); color: #d1d5db; }

  /* Avatar dropdown */
  .avatar-wrapper { position: relative; }
  .avatar-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    width: 260px; z-index: 50; display: none; overflow: hidden;
  }
  .avatar-dropdown.open { display: block; }
  .avatar-dropdown-header {
    padding: 14px; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex; gap: 10px; align-items: center;
  }
  .avatar-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; font-size: 13px; cursor: pointer;
    transition: background 0.1s; border: none; background: none;
    width: 100%; text-align: left; color: var(--text-primary);
  }
  .avatar-dropdown-item:hover { background: var(--bg-secondary); }
  .avatar-dropdown-item.danger:hover { background: var(--red-bg); color: var(--red-text); }
  .avatar-dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }
  .theme-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; font-size: 13px;
  }
  .switch { position: relative; width: 36px; height: 20px; }
  .switch input { display: none; }
  .switch .slider {
    position: absolute; inset: 0; background: var(--border);
    border-radius: 10px; cursor: pointer; transition: 0.2s;
  }
  .switch .slider::before {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: white;
    border-radius: 50%; transition: 0.2s;
  }
  .switch input:checked + .slider { background: var(--cvl-orange); }
  .switch input:checked + .slider::before { transform: translateX(16px); }

  /* Multi-step form */
  .step { cursor: pointer; transition: all 0.15s; }
  .step:hover { background: var(--cvl-orange-light); color: var(--cvl-orange-dark); }
  .step.done { background: var(--green-bg); color: var(--green-text); }
  .step.done::before { content: "✓ "; }
  .form-step { animation: fadeIn 0.3s; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

  /* Toast notification */
  .toast {
    position: fixed; top: 80px; right: 24px;
    background: var(--cvl-navy); color: white;
    padding: 12px 18px; border-radius: 8px;
    font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 200; opacity: 0; transform: translateY(-10px);
    transition: all 0.25s; pointer-events: none;
  }
  .toast.show { opacity: 1; transform: translateY(0); }
  .toast.success { background: var(--green); }
  .toast.error { background: var(--red); }

  /* Utility for spinners on bars */
  .bar-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 12px; }
  .bar-row:last-child { border-bottom: none; }
  .bar-row .name { width: 130px; flex-shrink: 0; }
  .bar-row .bar-track { flex: 1; height: 8px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; }
  .bar-row .bar-track .fill { height: 100%; }
  .bar-row .count { width: 36px; text-align: right; font-weight: 600; }


/* ============ DJANGO ADDITIONS — utilities used by existing templates ============ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-1 { gap: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.text-orange { color: var(--cvl-orange); }
.text-green { color: var(--green-text); }
.text-red { color: var(--red-text); }
.text-secondary { color: var(--text-secondary); }
.text-xs { font-size: 11px; }
.pill.gray { background: var(--gray-bg); color: var(--gray-text); }

/* alerts (used by nouveau.html) */
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.alert-danger { background: var(--red-bg); color: var(--red-text); }
.alert-warning { background: var(--amber-bg); color: var(--amber-text); }
.alert-info { background: var(--cvl-blue-light); color: #2B5A95; }
.alert-success { background: var(--green-bg); color: var(--green-text); }

/* Forms additions */
.form-group textarea { resize: vertical; min-height: 60px; }
table { width: 100%; border-collapse: collapse; }
table th { text-align: left; padding: 8px 10px; font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
table td { padding: 10px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
table tr.clickable { cursor: pointer; }
table tr.clickable:hover { background: var(--bg-secondary); }

/* Sidebar additions for new sub-items */
.nav-item.sub { padding-left: 28px; font-size: 12px; color: var(--text-secondary); }
.nav-item.sub:hover { color: var(--cvl-orange); }

/* Dark mode utilities */
body.dark-mode table th { background: #1c2740; color: #cbd5e1; border-color: #2a3548; }
body.dark-mode table td { border-color: #2a3548; }
body.dark-mode table tr.clickable:hover { background: #1c2740; }
body.dark-mode .alert-danger { background: rgba(239,68,68,0.18); color: #fca5a5; }
body.dark-mode .alert-warning { background: rgba(245,158,11,0.18); color: #fcd34d; }
body.dark-mode .alert-info { background: rgba(113,150,206,0.2); color: #93c5fd; }
body.dark-mode .alert-success { background: rgba(16,185,129,0.2); color: #6ee7b7; }

/* ============ ÉTIQUETTES / LABELS — module impression QR ============ */
.label-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  max-height: 600px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}
.cvl-label {
  width: 240px;
  height: 480px;
  background: white;
  border: 2px solid var(--cvl-navy);
  border-radius: 4px;
  padding: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--cvl-navy);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.cvl-label .lbl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1.5px solid var(--cvl-navy);
  padding-bottom: 6px;
  margin-bottom: 6px;
}
.cvl-label .lbl-brand { font-size: 11px; font-weight: 700; color: var(--cvl-navy); font-style: italic; }
.cvl-label .lbl-brand .accent { color: var(--cvl-orange); font-weight: 400; }
.cvl-label .lbl-tagline { font-size: 7px; color: var(--text-secondary); }
.cvl-label .lbl-colis {
  background: var(--cvl-orange);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}
.cvl-label .lbl-mode {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--cvl-navy);
  color: white;
  font-size: 8px;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.cvl-label .lbl-row {
  display: flex;
  gap: 4px;
  padding: 2px 0;
  border-bottom: 1px dotted #e5e7eb;
  align-items: baseline;
}
.cvl-label .lbl-label {
  font-size: 7px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 56px;
  font-weight: 600;
}
.cvl-label .lbl-value { font-size: 10px; font-weight: 600; flex: 1; word-break: break-word; }
.cvl-label .lbl-strong { font-size: 12px; font-weight: 700; }
.cvl-label .lbl-qr-zone {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1.5px dashed var(--border);
  align-items: center;
  justify-content: center;
}
.cvl-label .lbl-qr-main, .cvl-label .lbl-qr-secondary { text-align: center; }
.cvl-label .lbl-qr-main canvas, .cvl-label .lbl-qr-main img,
.cvl-label .lbl-qr-secondary canvas, .cvl-label .lbl-qr-secondary img {
  display: block;
  margin: 0 auto;
}
.cvl-label .lbl-qr-caption { font-size: 8px; color: var(--text-secondary); text-align: center; margin-top: 3px; font-weight: 600; }
.cvl-label .lbl-footer {
  font-size: 7px;
  color: var(--text-secondary);
  text-align: center;
  padding-top: 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================
   IMPRESSION
   ========================================== */

/* Mode 1 : Etiquettes 100x200mm (Zebra/Brother) - active via body.print-labels-mode */
@media print {
  body.print-labels-mode * { visibility: hidden; }
  body.print-labels-mode #print-area,
  body.print-labels-mode #print-area * { visibility: visible; }
  body.print-labels-mode #print-area {
    position: absolute; left: 0; top: 0; width: 100mm; background: white;
  }
  body.print-labels-mode #print-area .cvl-label {
    width: 100mm; height: 200mm; box-sizing: border-box;
    padding: 5mm; border: 0; page-break-after: always; font-size: 11pt;
  }
  body.print-labels-mode #print-area .cvl-label:last-child { page-break-after: auto; }
  body.print-labels-mode .lbl-brand { font-size: 15pt; }
  body.print-labels-mode .lbl-colis { font-size: 22pt; padding: 8px 14px; }
  body.print-labels-mode .lbl-value { font-size: 12pt; }
  body.print-labels-mode .lbl-strong { font-size: 14pt; }
  body.print-labels-mode .lbl-label { font-size: 9pt; }
}

/* Mode 2 : Documents A4 (chemise fiche, BL/HBL, AWB/HAWB, manifest, devis, facture...) */
@media print {
  /* Cacher chrome de l'app — selecteurs absolus car le DOM est .app > .main > .topbar */
  body:not(.print-labels-mode) .sidebar,
  body:not(.print-labels-mode) .topbar,
  body:not(.print-labels-mode) .breadcrumb,
  body:not(.print-labels-mode) .toast,
  body:not(.print-labels-mode) .alert,
  body:not(.print-labels-mode) .nav-section,
  body:not(.print-labels-mode) .no-print { display: none !important; }
  body:not(.print-labels-mode) { background: white !important; margin: 0 !important; }
  body:not(.print-labels-mode) .app,
  body:not(.print-labels-mode) .main,
  body:not(.print-labels-mode) .content,
  body:not(.print-labels-mode) .main-content {
    display: block !important; margin: 0 !important; padding: 0 !important;
    width: 100% !important; max-width: 100% !important;
  }
  /* Modale en mode print : afficher seulement celle marquee print-target */
  body:not(.print-labels-mode) .modal-overlay:not(.print-target) { display: none !important; }
  body:not(.print-labels-mode) .modal-overlay.print-target {
    position: static !important; background: white !important; padding: 0 !important;
    display: block !important; overflow: visible !important;
  }
  body:not(.print-labels-mode) .modal-overlay.print-target .modal {
    box-shadow: none !important; max-width: 100% !important; width: 100% !important;
    max-height: none !important; overflow: visible !important; border: 0 !important;
  }
  body:not(.print-labels-mode) .modal-overlay.print-target .modal-header,
  body:not(.print-labels-mode) .modal-overlay.print-target .modal-close,
  body:not(.print-labels-mode) .modal-overlay.print-target .modal-footer { display: none !important; }
  /* Eviter coupure des lignes/cellules au milieu */
  tr, td, th { page-break-inside: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
}

@page { size: A4; margin: 12mm; }
