/* ===== DESIGN SYSTEM ===== */
    :root {
      --primary:      #E63946;
      --primary-dk:   #c1121f;
      --secondary:    #1D3557;
      --secondary-lt: #457B9D;
      --bg:           #F1F3F5;
      --card:         #FFFFFF;
      --text:         #212529;
      --muted:        #6C757D;
      --border:       #DEE2E6;
      --success:      #2a9d5c;
      --radius:       10px;
      --shadow:       0 2px 12px rgba(0,0,0,0.08);
    }
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.35; overflow-x: hidden; }
    body.no-scroll { overflow: hidden; }

    /* ===== HEADER ===== */
    header {
      background: var(--card);
      border-bottom: 3px solid var(--primary);
      padding: 14px 28px;
      display: flex; align-items: center; gap: 18px;
      box-shadow: var(--shadow);
    }
    header .logo { width: 64px; }
    header h1   { font-size: 1.5rem; color: var(--secondary); }
    header p    { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

    /* ===== CAR INFO BAR ===== */
    .info-bar {
      background: var(--secondary);
      padding: 10px 28px;
      display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
    }
    .info-chip {
      display: flex; flex-direction: column; gap: 2px;
    }
    .chip-label {
      font-size: 0.68rem;
      color: rgba(255,255,255,0.50);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }
    .chip-value {
      font-size: 0.9rem;
      color: rgba(255,255,255,0.85);
      font-weight: 600;
    }
    #dossierBadge {
      margin-left: auto;
      background: var(--primary);
      color: #fff;
      font-weight: 700;
      font-size: 0.9rem;
      padding: 5px 14px;
      border-radius: 999px;
      white-space: nowrap;
    }

    /* ===== MAIN LAYOUT ===== */
    .main-layout {
      display: flex; gap: 16px; padding: 16px 24px; align-items: flex-start;
    }

    .already-sent-view {
      padding: 18px 24px 0;
    }
    .already-sent-card {
      background: var(--card);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      border-left: 6px solid var(--success);
      padding: 20px 22px;
    }
    .already-sent-card h2 {
      font-size: 1.18rem;
      color: var(--secondary);
      margin-bottom: 10px;
    }
    .already-sent-card p {
      margin: 0 0 8px;
      color: var(--text);
      font-size: 0.93rem;
    }
    .already-sent-meta {
      color: var(--muted);
      font-size: 0.84rem;
    }
    .already-sent-help {
      margin-bottom: 0;
      color: var(--muted);
      font-size: 0.84rem;
    }

    /* ===== SVG AREA ===== */
    .svg-area {
      flex: 1; background: var(--card); border-radius: var(--radius);
      box-shadow: var(--shadow); padding: 16px; overflow: hidden;
      min-width: 0;
    }
    .svg-area-title {
      font-size: 0.9rem; font-weight: 600; color: var(--muted);
      margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
    }
    .svg-area-title::before {
      content:''; display: inline-block; width: 4px; height: 16px;
      background: var(--primary); border-radius: 2px;
    }
    #voiture-container { width: 100%; }
    #voiture-container svg { display: block; width: 100%; height: auto; cursor: pointer; }

    /* Highlight selected pieces */
    #voiture-container use.piece-selected {
      filter: brightness(0) saturate(1) invert(29%) sepia(90%) saturate(600%) hue-rotate(330deg) brightness(1.1) drop-shadow(0 0 6px var(--primary));
    }

    /* ===== ACTION BUTTONS ===== */
    .action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
    .action-buttons .btn { flex: 0 1 auto; }
    .btn {
      padding: 8px 16px; border-radius: 8px; border: none;
      cursor: pointer; font-size: 0.85rem; font-weight: 600;
      transition: all .2s; line-height: 1.4;
    }
    .btn-primary   { background: var(--primary); color: #fff; }
    .btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); }
    .btn-secondary { background: var(--secondary); color: #fff; }
    .btn-secondary:hover { background: #263f68; transform: translateY(-1px); }
    .btn-outline   { background: #fff; border: 2px solid var(--primary); color: var(--primary); }
    .btn-outline:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

    /* ===== SIDE PANEL ===== */
    .side-panel { width: 310px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
    .panel-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
    .panel-header {
      background: var(--secondary); color: #fff;
      padding: 12px 16px; font-weight: 700; font-size: 0.95rem;
      display: flex; align-items: center; justify-content: space-between;
    }
    .count-badge {
      background: var(--primary); border-radius: 999px;
      padding: 2px 9px; font-size: 0.78rem; font-weight: 700;
    }
    #parts-list { max-height: 340px; overflow-y: auto; }

    .piece-item {
      display: flex; align-items: center; padding: 10px 14px;
      border-bottom: 1px solid var(--border); gap: 8px;
      animation: slideIn .18s ease;
    }
    @keyframes slideIn {
      from { opacity: 0; transform: translateX(8px); }
      to   { opacity: 1; transform: translateX(0); }
    }
    .piece-item:last-child { border-bottom: none; }
    .pi-info      { flex: 1; min-width: 0; }
    .pi-name      { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pi-action    { font-size: 0.74rem; color: var(--muted); margin-top: 1px; }
    .pi-price     { font-weight: 700; color: var(--secondary); font-size: 0.9rem; white-space: nowrap; }
    .btn-del {
      background: none; border: none; color: var(--primary);
      cursor: pointer; font-size: 1rem; padding: 3px 5px;
      border-radius: 4px; transition: background .2s;
    }
    .btn-del:hover { background: #ffe0e3; }
    .btn-edit {
      background: none; border: none; color: #94a3b8;
      cursor: pointer; font-size: 0.88rem; padding: 3px 5px;
      border-radius: 4px; transition: background .2s, color .2s;
    }
    .btn-edit:hover { background: #eff6ff; color: var(--secondary); }
    .pi-price-missing {
      font-size: 0.72rem; font-weight: 700; color: var(--primary);
      background: #fff0f0; border: 1px solid #fecaca;
      border-radius: 6px; padding: 2px 7px; white-space: nowrap;
    }

    .empty-state { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 0.88rem; }
    .empty-icon  { font-size: 2.2rem; margin-bottom: 8px; }

    .total-row {
      display: flex; justify-content: space-between; align-items: center;
      padding: 13px 16px; background: #f8f9fa; border-top: 2px solid var(--border);
    }
    .total-label  { font-weight: 600; font-size: 0.9rem; color: var(--muted); }
    .total-amount { font-size: 1.25rem; font-weight: 800; color: var(--secondary); }

    .btn-send {
      width: 100%; padding: 14px; background: var(--primary); color: #fff;
      border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 700;
      cursor: pointer; transition: all .2s; letter-spacing: .4px;
    }
    .btn-send:hover:not(:disabled) {
      background: var(--primary-dk); transform: translateY(-2px);
      box-shadow: 0 4px 14px rgba(230,57,70,.4);
    }
    .btn-send:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

    /* ===== MODAL CONFIRMATION ===== */
    .modal-box-lg { max-width: 480px; }
    .confirm-subtitle { font-size: 0.82rem; color: var(--muted); margin: 0 0 12px; }
    .confirm-list {
      max-height: 220px; overflow-y: auto;
      border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px;
    }
    .confirm-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 8px 12px; border-bottom: 1px solid var(--border); gap: 8px;
    }
    .confirm-row:last-child { border-bottom: none; }
    .confirm-row-name { font-size: 0.82rem; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .confirm-row-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
    .confirm-row-label { font-size: 0.72rem; color: var(--muted); }
    .confirm-row-price { font-size: 0.84rem; font-weight: 700; color: var(--secondary); }
    .confirm-total-row {
      display: flex; justify-content: space-between; align-items: center;
      padding: 10px 12px; background: #f8f9fa; border-radius: var(--radius);
      margin-bottom: 10px; font-size: 0.88rem; font-weight: 600; color: var(--muted);
    }
    .confirm-total-amount { font-size: 1.1rem; font-weight: 800; color: var(--secondary); }
    .confirm-obs { margin-bottom: 4px; font-size: 0.8rem; display: none; }
    .confirm-obs-title { font-weight: 700; color: var(--secondary); margin-bottom: 5px; }
    .confirm-obs-item { color: var(--muted); padding: 2px 0; }

    /* ===== LOADING OVERLAY ===== */
    .loading-overlay {
      display: none;
      position: fixed; inset: 0; z-index: 9999;
      background: rgba(15,23,42,.55);
      -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
      align-items: center; justify-content: center;
    }
    .loading-overlay.visible { display: flex; }
    .loading-card {
      background: #fff; border-radius: 18px;
      padding: 40px 48px; text-align: center;
      box-shadow: 0 24px 60px rgba(0,0,0,.22);
      min-width: 280px; max-width: 360px; width: 90%;
      animation: overlayIn .25s ease;
    }
    @keyframes overlayIn {
      from { opacity: 0; transform: scale(.92) translateY(12px); }
      to   { opacity: 1; transform: scale(1)  translateY(0); }
    }
    .loading-spinner { width: 64px; height: 64px; margin-bottom: 20px; }
    .loading-label {
      font-size: 1rem; font-weight: 700; color: var(--secondary);
      margin: 0 0 18px; min-height: 24px; transition: color .3s;
    }
    .loading-track {
      height: 6px; background: #f1f5f9; border-radius: 99px;
      overflow: hidden; margin-bottom: 18px;
    }
    .loading-fill {
      height: 100%; width: 0%;
      background: linear-gradient(90deg, var(--primary), var(--secondary));
      border-radius: 99px; transition: width .6s ease;
    }
    .loading-steps { display: flex; flex-direction: column; gap: 9px; text-align: left; }
    .loading-step {
      display: flex; align-items: center; gap: 10px;
      font-size: 0.82rem; color: #94a3b8; transition: color .3s;
    }
    .loading-step-dot {
      width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
      background: #e2e8f0; border: 2px solid #e2e8f0; transition: all .3s;
    }
    .loading-step.active { color: var(--secondary); font-weight: 700; }
    .loading-step.active .loading-step-dot {
      background: transparent; border-color: var(--secondary);
      box-shadow: 0 0 0 3px rgba(22,61,117,.15);
      animation: pulse-dot 1s ease-in-out infinite;
    }
    .loading-step.done { color: var(--success); font-weight: 600; }
    .loading-step.done .loading-step-dot {
      background: var(--success); border-color: var(--success);
    }
    @keyframes pulse-dot {
      0%, 100% { transform: scale(1);   }
      50%       { transform: scale(1.4); }
    }
    .loading-label.success { color: var(--success); }

    /* ===== OBSERVATIONS ===== */
    .obs-card .panel-header { display: flex; align-items: center; justify-content: space-between; }
    .obs-add-btn {
      background: rgba(255,255,255,0.2); border: none; color: #fff;
      width: 24px; height: 24px; border-radius: 50%; font-size: 1.1rem; line-height: 1;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: background .2s;
    }
    .obs-add-btn:hover { background: rgba(255,255,255,0.35); }
    #obs-list { padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
    #obs-list:empty { padding: 0; }
    .obs-row {
      display: flex; align-items: flex-start; gap: 6px;
    }
    .obs-row .obs-piece-select,
    .obs-row .obs-piece-input {
      flex: 1; min-height: 36px; padding: 6px 10px;
      border: 1px solid var(--border); border-radius: 6px;
      font-size: 0.84rem; font-family: inherit; outline: none;
      transition: border-color .2s; background: #fff;
    }
    .obs-row .obs-piece-select:focus,
    .obs-row .obs-piece-input:focus { border-color: var(--secondary); }
    .obs-row .obs-piece-select.err,
    .obs-row .obs-piece-input.err { border-color: var(--primary); }
    .obs-del-btn {
      background: none; border: none; color: var(--muted);
      font-size: 1rem; cursor: pointer; padding: 4px; line-height: 1;
      flex-shrink: 0; margin-top: 4px;
    }
    .obs-del-btn:hover { color: var(--primary); }

    /* ===== MODALS / OVERLAYS ===== */
    .overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.52); z-index: 200;
      align-items: center; justify-content: center;
    }
    .overlay.open { display: flex; }
    .modal-box {
      background: var(--card); border-radius: var(--radius); width: 400px;
      max-width: 95vw; box-shadow: 0 10px 40px rgba(0,0,0,0.22);
      overflow: hidden; animation: popIn .18s ease;
    }
    @keyframes popIn {
      from { opacity: 0; transform: scale(.93); }
      to   { opacity: 1; transform: scale(1); }
    }
    .modal-head {
      background: var(--secondary); color: #fff; padding: 15px 20px;
      display: flex; align-items: center; justify-content: space-between;
    }
    .modal-head h3 { font-size: 1rem; }
    .btn-close-modal { background: none; border: none; color: rgba(255,255,255,.65); font-size: 1.2rem; cursor: pointer; }
    .btn-close-modal:hover { color: #fff; }
    .modal-body { padding: 20px; }

    .piece-badge {
      background: #eef2ff; border: 1px solid #c7d2fe; color: var(--secondary);
      border-radius: 6px; padding: 6px 12px; font-weight: 700;
      font-size: 0.92rem; display: inline-block; margin-bottom: 16px;
      max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }

    .action-choice { display: flex; gap: 10px; margin-bottom: 16px; }
    #overlayPiece.direct .action-choice { display: none; }
    #overlayPiece.direct .type-piece-wrap { display: none; }



    .btn-action {
      flex: 1; padding: 12px; border: 2px solid var(--border);
      border-radius: 8px; background: #fff; cursor: pointer;
      font-size: 0.88rem; font-weight: 700; text-align: center; transition: all .2s;
    }
    .btn-action:hover  { border-color: var(--secondary-lt); color: var(--secondary); }
    .btn-action.chosen { border-color: var(--secondary); background: var(--secondary); color: #fff; }

    .type-piece-wrap { display: none; margin-bottom: 16px; }
    .type-piece-wrap.show { display: block; }
    .type-piece-wrap label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 5px; }
    .type-piece-wrap select {
      width: 100%; padding: 10px 14px; border: 2px solid var(--border);
      border-radius: 8px; font-size: 0.95rem; outline: none; transition: border-color .2s;
      background: #fff;
    }
    .type-piece-wrap select:focus { border-color: var(--primary); }
    .type-piece-wrap select.err   { border-color: var(--primary); }

    .hours-wrap { display: none; margin-bottom: 16px; }
    .hours-wrap.show { display: block; }
    .hours-wrap label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 5px; }
    .hours-wrap input {
      width: 100%; padding: 10px 14px; border: 2px solid var(--border);
      border-radius: 8px; font-size: 1rem; outline: none; transition: border-color .2s;
    }
    .hours-wrap input:focus { border-color: var(--primary); }
    .hours-wrap input.err   { border-color: var(--primary); }

    .modal-actions { display: flex; gap: 8px; }
    .btn-confirm {
      flex: 1; padding: 11px; background: var(--primary); color: #fff;
      border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: background .2s;
    }
    .btn-confirm:hover:not(:disabled) { background: var(--primary-dk); }
    .btn-confirm:disabled { background: #ccc; cursor: not-allowed; }
    .btn-cancel {
      padding: 11px 20px; background: #f0f0f0; color: var(--muted);
      border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
    }
    .btn-cancel:hover { background: #e2e2e2; }

    /* SOUS-PIECES MODAL */
    .sous-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
      max-height: 300px; overflow-y: auto; padding: 4px 0;
    }
    .sp-btn {
      padding: 10px 6px; border: 2px solid var(--border); border-radius: 8px;
      background: #fff; cursor: pointer; font-size: 0.8rem; font-weight: 600;
      text-align: center; transition: all .2s; line-height: 1.3;
    }
    .sp-btn:hover { border-color: var(--primary); color: var(--primary); background: #fff5f5; }

    /* SEARCH OVERLAY */
    .search-box {
      background: var(--card); border-radius: var(--radius); width: 500px;
      max-width: 95vw; max-height: 80vh; display: flex; flex-direction: column;
      box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    }
    .search-head {
      padding: 15px 20px; border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
    }
    .search-head h3 { font-size: 1rem; color: var(--secondary); }
    .btn-search-close { padding: 6px 12px; }
    .search-input-wrap { padding: 14px 20px; }
    .search-input-wrap input {
      width: 100%; padding: 10px 14px; border: 2px solid var(--border);
      border-radius: 8px; font-size: 0.95rem; outline: none; transition: border-color .2s;
    }
    .search-input-wrap input:focus { border-color: var(--primary); }
    #listeSuggestions { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
    #listeSuggestions li {
      list-style: none; padding: 10px 14px; cursor: pointer;
      border-radius: 7px; font-size: 0.88rem; transition: background .15s;
    }
    #listeSuggestions li:hover { background: #f5f5f5; color: var(--primary); font-weight: 600; }

    /* ===== TOAST ===== */
    #toast {
      position: fixed; bottom: 22px; right: 22px; padding: 12px 22px;
      border-radius: 8px; color: #fff; font-size: 0.9rem; font-weight: 600;
      box-shadow: 0 4px 16px rgba(0,0,0,0.18); z-index: 999;
      display: none; animation: slideUp .25s ease;
    }
    @keyframes slideUp {
      from { transform: translateY(16px); opacity: 0; }
      to   { transform: translateY(0); opacity: 1; }
    }

    /* ===== RESPONSIVE ===== */
    @media (max-width: 1200px) {
      header { padding: 12px 20px; }
      .info-bar { padding: 10px 20px; gap: 14px 18px; }
      .main-layout { padding: 14px 16px; gap: 12px; }
      .side-panel { width: 290px; top: 12px; }
    }

    @media (max-width: 1024px) {
      header {
        padding: 12px 16px;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
      }
      header .logo { width: 52px; }
      header h1 { font-size: 1.2rem; line-height: 1.2; }
      header p { font-size: 0.8rem; }

      .info-bar {
        padding: 9px 14px;
        gap: 10px 12px;
      }
      .info-chip {
        flex: 1 1 160px;
        min-width: 130px;
      }
      #dossierBadge {
        margin-left: 0;
        width: 100%;
        text-align: center;
      }

      .main-layout {
        flex-direction: column;
        align-items: stretch;
      }
      .already-sent-view {
        padding: 12px 16px 0;
      }
      .svg-area { padding: 12px; }
      .side-panel {
        width: 100%;
        position: static;
        top: auto;
      }
      .action-buttons .btn { flex: 1 1 180px; }
    }

    @media (max-width: 768px) {
      .btn,
      .btn-send,
      .btn-action,
      .btn-cancel,
      .btn-confirm,
      .sp-btn,
      .btn-close-modal {
        min-height: 44px;
      }
      .obs-add-btn,
      .obs-del-btn,
      .btn-del,
      .btn-edit {
        min-width: 40px;
        min-height: 40px;
      }

      header { padding: 10px 12px; }
      header .logo { width: 44px; }
      header h1 { font-size: 1rem; }
      header p { font-size: 0.74rem; }

      .info-bar {
        padding: 8px 12px;
        gap: 8px;
      }
      .info-chip {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
      }
      .chip-label { font-size: 0.62rem; }
      .chip-value { font-size: 0.84rem; }
      #dossierBadge {
        font-size: 0.82rem;
        padding: 5px 10px;
      }

      .main-layout {
        padding: 10px;
        gap: 10px;
      }
      .already-sent-view {
        padding: 10px 10px 0;
      }
      .already-sent-card {
        padding: 14px;
      }
      .already-sent-card h2 {
        font-size: 1.03rem;
      }
      .already-sent-card p {
        font-size: 0.86rem;
      }
      .svg-area {
        padding: 10px;
        border-radius: 8px;
      }
      .svg-area-title {
        margin-bottom: 8px;
        font-size: 0.82rem;
      }
      #voiture-container {
        overflow-x: auto;
        overflow-y: hidden;
      }
      #voiture-container svg {
        width: 680px;
        min-width: 680px;
        max-width: none;
      }

      .action-buttons {
        margin-top: 10px;
        gap: 8px;
      }
      .action-buttons .btn {
        width: 100%;
        flex: 1 1 100%;
        padding: 10px 12px;
        font-size: 0.9rem;
      }

      .panel-header {
        padding: 10px 12px;
        font-size: 0.88rem;
      }
      #parts-list { max-height: 260px; }
      .piece-item {
        padding: 9px 10px;
        gap: 6px;
      }
      .pi-name { font-size: 0.8rem; }
      .pi-action { font-size: 0.7rem; }
      .pi-price { font-size: 0.84rem; }
      .total-row { padding: 10px 12px; }
      .total-amount { font-size: 1.1rem; }
      .btn-send {
        padding: 12px;
        font-size: 0.95rem;
      }

      .modal-box {
        width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
        max-width: none;
        max-height: calc(100vh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
      }
      .modal-box-lg { max-width: none; }
      .modal-head { padding: 12px 14px; }
      .modal-head h3 { font-size: 0.95rem; }
      .modal-body {
        padding: 14px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
      }
      .search-input-wrap input,
      .type-piece-wrap select,
      .hours-wrap input,
      .obs-row .obs-piece-input,
      .obs-row .obs-piece-select {
        font-size: 16px;
      }
      .action-choice { flex-direction: column; }
      .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
      }
      .btn-cancel,
      .btn-confirm {
        width: 100%;
        padding: 10px 12px;
      }
      .sous-grid {
        grid-template-columns: 1fr;
        max-height: 46vh;
      }

      .search-box {
        width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
        max-width: none;
        max-height: calc(100vh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        border-radius: 10px;
      }
      .search-head { padding: 12px 14px; }
      .search-input-wrap { padding: 10px 14px; }

      .loading-card {
        width: calc(100vw - 24px);
        max-width: 360px;
        min-width: 0;
        padding: 24px 16px;
      }
      .loading-spinner {
        width: 52px;
        height: 52px;
        margin-bottom: 14px;
      }

      #toast {
        left: calc(10px + env(safe-area-inset-left));
        right: calc(10px + env(safe-area-inset-right));
        bottom: calc(12px + env(safe-area-inset-bottom));
        padding: 10px 14px;
        font-size: 0.84rem;
        text-align: center;
      }
    }

    @media (max-width: 560px) {
      .info-chip { flex: 1 1 100%; }
      #dossierBadge {
        width: auto;
        text-align: left;
      }

      #voiture-container svg {
        width: 560px;
        min-width: 560px;
      }

      .confirm-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
      }
      .confirm-row-right {
        width: 100%;
        justify-content: space-between;
      }
      .confirm-total-row { font-size: 0.82rem; }
      .confirm-total-amount { font-size: 1rem; }
      .obs-del-btn {
        margin-top: 0;
        align-self: center;
      }
    }

    @media (max-width: 400px) {
      header {
        padding: 8px 10px;
        gap: 8px;
      }
      header .logo { width: 38px; }
      header h1 { font-size: 0.92rem; }
      header p { font-size: 0.7rem; }

      .info-bar {
        padding: 7px 10px;
        gap: 7px;
      }
      .chip-label { font-size: 0.58rem; }
      .chip-value { font-size: 0.8rem; }
      #dossierBadge {
        font-size: 0.78rem;
        padding: 4px 9px;
      }

      .main-layout { padding: 8px; gap: 8px; }
      .svg-area { padding: 8px; }
      .svg-area-title { font-size: 0.78rem; }

      .panel-header {
        padding: 9px 10px;
        font-size: 0.82rem;
      }
      #parts-list { max-height: 220px; }
      .piece-item { padding: 8px 9px; }
      .pi-name { font-size: 0.77rem; }
      .pi-action { font-size: 0.68rem; }
      .btn-send {
        font-size: 0.9rem;
        padding: 11px 10px;
      }

      .modal-head {
        padding: 10px 12px;
      }
      .modal-head h3 { font-size: 0.9rem; }
      .modal-body { padding: 12px; }

      .search-head { padding: 10px 12px; }
      .search-input-wrap { padding: 9px 12px; }
      #listeSuggestions li {
        padding: 9px 10px;
        font-size: 0.82rem;
      }

      .loading-card {
        width: calc(100vw - 16px);
        padding: 20px 12px;
      }
      .loading-label {
        font-size: 0.9rem;
        margin-bottom: 14px;
      }
    }

    @media (max-width: 360px) {
      #voiture-container svg {
        width: 520px;
        min-width: 520px;
      }
      .confirm-row-name {
        max-width: 100%;
      }
      .confirm-row-label {
        font-size: 0.68rem;
      }
      #toast {
        font-size: 0.8rem;
        padding: 9px 10px;
      }
    }

    @supports (height: 100dvh) {
      @media (max-width: 768px) {
        .modal-box {
          max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        }
        .modal-body {
          max-height: calc(100dvh - 120px);
        }
        .search-box {
          max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        }
      }
    }
