.camera-launch-row { display: flex; align-items: center; gap: 10px; margin: -8px 24px 16px; }
.product-workspace-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-bottom: 16px; padding: 6px; border: 1px solid #dce6e0; border-radius: 13px; background: #edf2ef; }
.product-workspace-nav button { min-width: 0; display: grid; grid-template-columns: 30px 1fr; align-items: center; column-gap: 9px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #68756d; text-align: left; }
.product-workspace-nav button .lucide { grid-row: 1 / 3; width: 18px; height: 18px; justify-self: center; }
.product-workspace-nav button span { font-size: 10px; font-weight: 800; }
.product-workspace-nav button small { margin-top: 2px; color: #8a958e; font-size: 8px; }
.product-workspace-nav button:hover { background: #f7faf8; color: var(--green); }
.product-workspace-nav button.active { border-color: #c9ddd2; background: #fff; color: var(--green); box-shadow: 0 4px 13px #173f310d; }
.product-workspace-view { animation: workspace-view-in .18s ease both; }
.configuration-nav { display: inline-flex; gap: 5px; margin-bottom: 18px; padding: 5px; border: 1px solid #dce6e0; border-radius: 11px; background: #edf2ef; }
.configuration-nav button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #66746c; font-size: 9px; font-weight: 800; }
.configuration-nav button .lucide { width: 15px; height: 15px; }
.configuration-nav button.active { border-color: #c9ddd2; background: #fff; color: var(--green); box-shadow: 0 3px 10px #173f310d; }
@keyframes workspace-view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.camera-launch-row small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.camera-launch { border: 1px solid #bad9ca; background: #edf8f2; color: var(--green); white-space: nowrap; }
.camera-launch:hover { background: #e3f3eb; }
.camera-http-fallback .camera-launch { border-color: #e6c88e; background: #fff7e8; color: #945b12; }
.camera-http-fallback small { color: #9a641d; font-weight: 700; }
.capture-form .camera-launch-row { margin: -4px 19px 14px; }
.analysis-camera-launch { margin-top: -8px; }

.camera-dialog { width: min(900px,calc(100% - 20px)); max-height: 96vh; padding: 0; overflow: hidden; border: 0; border-radius: 16px; background: #111713; color: #fff; box-shadow: 0 30px 100px #0009; }
.camera-dialog::backdrop { background: #06100bd9; }
.camera-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 16px 18px; background: #17211b; }
.camera-head h2 { margin: 0 0 4px; font-size: 17px; }
.camera-head p { margin: 0; color: #aab7af; font-size: 10px; }
.camera-head .icon-button { color: #d8e0db; }
.camera-stage { position: relative; display: grid; place-items: center; min-height: 340px; max-height: 58vh; overflow: hidden; background: #060806; }
.camera-stage video { width: 100%; height: 100%; max-height: 58vh; object-fit: contain; background: #000; }
.camera-starting { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: #0d120f; color: #b7c2bb; font-size: 11px; }
.camera-starting .lucide { width: 28px; height: 28px; }
.camera-counter { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 16px; background: #07110bbb; backdrop-filter: blur(6px); }
.camera-counter b { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #14201b; font-size: 10px; }
.camera-counter span { font-size: 9px; }
.camera-error { margin: 10px 16px 0; padding: 10px 12px; border: 1px solid #7d3838; border-radius: 8px; background: #3a1d1d; color: #ffd6d6; font-size: 10px; }
.camera-review { min-height: 86px; max-height: 145px; display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; background: #111713; }
.camera-review-empty { width: 100%; display: grid; place-items: center; color: #849188; font-size: 9px; text-align: center; }
.camera-shot { position: relative; width: 72px; min-width: 72px; height: 82px; overflow: hidden; border: 2px solid #344139; border-radius: 9px; background: #050805; }
.camera-shot img { width: 100%; height: 100%; object-fit: cover; }
.camera-shot > span { position: absolute; left: 4px; bottom: 4px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 10px; background: #07110bbb; color: #fff; font-size: 8px; font-weight: 800; }
.camera-shot button { position: absolute; top: 4px; right: 4px; width: 23px; height: 23px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: #111c17e6; color: #fff; }
.camera-shot button .lucide { width: 13px; height: 13px; }
.camera-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 15px; padding: 13px 18px 17px; border-top: 1px solid #2a352e; background: #17211b; }
.camera-controls > :first-child { justify-self: start; }
.camera-controls > :last-child { justify-self: end; }
.camera-shutter { width: 64px; height: 64px; display: grid; place-items: center; padding: 0; border: 4px solid #fff; border-radius: 50%; background: transparent; }
.camera-shutter span { width: 46px; height: 46px; border-radius: 50%; background: #fff; transition: transform .12s ease,background .12s ease; }
.camera-shutter:active span { transform: scale(.84); background: #d9eee3; }
.camera-shutter:disabled { opacity: .35; cursor: not-allowed; }

.protocols-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 20px; border: 1px solid #cfe0d7; border-radius: 14px; background: linear-gradient(130deg,#edf7f1,#fff); }
.protocols-hero .intro { margin: 0; }
.protocols-hero h2 { margin-top: 4px; font-size: 21px; }
.protocols-hero p { max-width: 720px; line-height: 1.5; }
.protocols-kicker { color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: 1.15px; }
.protocol-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.protocol-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 24px #173f3108; }
.protocol-card header { display: flex; align-items: flex-start; gap: 11px; padding: 16px 17px 13px; border-bottom: 1px solid #e7ece9; background: #fbfdfc; }
.protocol-card header > span { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #e8f4ed; color: var(--green); }
.protocol-card header > span .lucide { width: 19px; height: 19px; }
.protocol-card header > div { min-width: 0; flex: 1; }
.protocol-card header > div > small,.protocol-problem > small,.protocol-steps > small,.protocol-message > div > small,.protocol-objective small { display: block; margin-bottom: 4px; color: #7a887f; font-size: 8px; font-weight: 800; letter-spacing: .55px; }
.protocol-card header h3 { margin: 0 0 4px; font-size: 13px; }
.protocol-card header p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.protocol-card header .protocol-card-actions { min-width: auto; flex: 0 0 auto; display: flex; gap: 5px; }
.protocol-card-actions button { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #657269; }
.protocol-card-actions button:last-child { color: var(--red); }
.protocol-card-actions .lucide { width: 14px; height: 14px; }
.protocol-problem { margin: 14px 16px 0; }
.protocol-problem p { margin: 0; color: #445149; font-size: 10px; line-height: 1.5; }
.protocol-objective { display: flex; gap: 9px; margin: 13px 16px 0; padding: 10px 11px; border-left: 3px solid #64a383; border-radius: 0 7px 7px 0; background: #f2f8f5; color: #496357; font-size: 9px; line-height: 1.45; }
.protocol-objective > span { flex: 0 0 auto; color: var(--green); }
.protocol-objective .lucide { width: 16px; height: 16px; }
.protocol-objective p { margin: 0; }
.protocol-steps { margin: 13px 16px; padding: 0; counter-reset: protocol-step; }
.protocol-steps ol { margin: 0; padding: 0; list-style: none; }
.protocol-steps li { position: relative; min-height: 26px; padding: 5px 0 5px 31px; color: #4e5d55; font-size: 9px; line-height: 1.45; counter-increment: protocol-step; }
.protocol-steps li::before { content: counter(protocol-step); position: absolute; top: 3px; left: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #eaf4ee; color: var(--green); font-size: 8px; font-weight: 900; }
.protocol-message { margin: 0 16px 16px; padding: 12px; border: 1px solid #e5dfd1; border-radius: 9px; background: #fffaf0; }
.protocol-message > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.protocol-message > div > small { margin: 0; }
.protocol-message p { margin: 10px 0 0; color: #564d3d; font: 10px/1.55 Inter,Segoe UI,Arial,sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.protocol-message button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border: 1px solid #dfd4bd; border-radius: 7px; background: #fff; color: #735f36; font-size: 8px; font-weight: 800; }
.protocol-message button .lucide { width: 13px; height: 13px; }
.protocol-message button.copied { background: #e5f3eb; border-color: #bcdac9; color: var(--green); }
.protocol-form-fields { padding-top: 18px; }
.protocol-form-fields label small { color: var(--muted); font-weight: 400; }
.protocol-form-fields textarea[name="steps"],.protocol-form-fields textarea[name="messageTemplate"] { min-height: 135px; }

@media (max-width: 760px) {
  .product-workspace-nav button { grid-template-columns: 23px 1fr; padding: 9px 7px; column-gap: 5px; }
  .product-workspace-nav button small { display: none; }
  .camera-launch-row,.protocols-hero { align-items: stretch; flex-direction: column; }
  .camera-launch { width: 100%; white-space: normal; }
  .protocol-grid { grid-template-columns: 1fr; }
  .protocols-hero .btn { align-self: flex-start; }
  .camera-stage { min-height: 280px; }
  .camera-controls { grid-template-columns: 1fr auto; }
  .camera-shutter { grid-row: 1; grid-column: 1 / -1; justify-self: center; }
  .camera-controls > :first-child { grid-row: 2; grid-column: 1; }
  .camera-controls > :last-child { grid-row: 2; grid-column: 2; }
}

@media (max-width: 520px) {
  .product-workspace-nav { position: sticky; top: 0; z-index: 8; gap: 3px; padding: 4px; }
  .product-workspace-nav button { display: flex; justify-content: center; gap: 5px; padding: 9px 5px; text-align: center; }
  .product-workspace-nav button span { font-size: 8px; }
  .configuration-nav { width: 100%; }
  .configuration-nav button { flex: 1; justify-content: center; }
  .camera-launch-row { margin-left: 12px; margin-right: 12px; }
  .camera-dialog { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; }
  .camera-stage { min-height: 46vh; max-height: 52vh; }
  .camera-stage video { max-height: 52vh; }
  .camera-controls .btn { padding-left: 10px; padding-right: 10px; font-size: 9px; }
}

/* Contraste et espacement cohérents pour toutes les actions */
.btn {
  min-height: 39px;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px #14201b0a;
  transition: background .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 13px #173f3117; }
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: 0 1px 3px #173f3112; }
.btn.primary { border-color: #105d42; box-shadow: 0 3px 9px #176b4c20; }
.btn.secondary {
  border-color: #cbd8d1;
  background: #f5f8f6;
  color: #27372e;
}
.btn.secondary:hover:not(:disabled) { border-color: #94b7a4; background: #eaf3ee; color: #105f43; }
.btn.danger { border-color: #9f2929; }
.btn.secondary:disabled { border-color: #d8dfdb; background: #eef1ef; color: #7b867f; opacity: .72; }
button:focus-visible { outline: 3px solid #5aa17f55; outline-offset: 2px; }

.text-button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid #d7e4dc;
  border-radius: 7px;
  background: #f5faf7;
}
.text-button:hover { border-color: #aacbb9; background: #eaf5ef; }
.icon-button {
  border-color: #dce3df;
  background: #f5f7f6;
  box-shadow: 0 1px 3px #14201b0c;
}
.trash-button { border-color: #e9caca; background: #fff4f4; }

.pack-lot-actions {
  align-items: center;
  padding: 12px 16px;
  background: #fbfcfb;
}
.pack-lot-actions .btn {
  min-height: 38px;
  border-color: #a9cdb9;
  background: #eaf5ef;
  color: #105f43;
  box-shadow: 0 2px 7px #176b4c12;
}
.pack-lot-actions .btn:hover { border-color: #78ae91; background: #dceee4; }
.pack-items {
  grid-template-columns: repeat(auto-fill,minmax(235px,285px));
  align-items: start;
  justify-content: start;
  gap: 15px;
  padding: 17px;
  background: #fcfdfc;
}
.pack-item { box-shadow: 0 3px 12px #173f310b; }
.pack-item-body { padding: 13px; }
.pack-item-actions {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #edf1ee;
}
.pack-item-actions > small { min-height: 13px; line-height: 1.45; }
.pack-item-actions > div {
  display: grid;
  grid-template-columns: minmax(0,1fr) 34px minmax(0,.82fr);
  gap: 6px;
  width: 100%;
}
.pack-item-actions .action-button { width: 100%; min-width: 0; min-height: 34px; padding-inline: 8px; }
.pack-item-actions .action-button.icon-only { width: 34px !important; }

.modal-actions {
  flex-wrap: wrap;
  padding-top: 17px;
  padding-bottom: 17px;
  background: #fafcfb;
}
.panel-head {
  gap: 12px;
  flex-wrap: wrap;
}
.api-card-head .api-test-button { min-width: 150px; }

.heic-pending-preview {
  width: 100%;
  height: 100%;
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 14px;
  background: linear-gradient(145deg,#edf7f1,#f9fcfa);
  color: #176b4c;
  text-align: center;
}
.heic-pending-preview .lucide { width: 30px; height: 30px; }
.heic-pending-preview b { font-size: 11px; }
.heic-pending-preview small { color: #64766c; font-size: 8px; line-height: 1.4; }

.heic-converting-preview {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  overflow: hidden;
  padding: 14px;
  background: linear-gradient(145deg,#eaf5ef,#fbfdfc);
  color: #176b4c;
  text-align: center;
}
.heic-converting-preview::after {
  content: "";
  position: absolute;
  left: -45%;
  bottom: 0;
  width: 45%;
  height: 4px;
  border-radius: 4px;
  background: #23845f;
  animation: heic-conversion-progress 1.15s ease-in-out infinite;
}
.heic-converting-preview .lucide { width: 30px; height: 30px; }
.heic-converting-preview b { font-size: 11px; }
.heic-converting-preview small { color: #64766c; font-size: 8px; line-height: 1.4; }
.preview.converting > button,.capture-photo.converting > button { opacity: .6; cursor: wait; }
.preview .media-rotate-button,.capture-photo .media-rotate-button {
  right: auto;
  left: 5px;
  z-index: 3;
  display: grid;
  place-items: center;
  background: #ffffffeb;
  color: #176b4c;
  border: 1px solid #cfe0d6;
  box-shadow: 0 2px 8px #0003;
}
.preview .media-remove-button,.capture-photo .media-remove-button { z-index: 3; }
.preview.is-primary,.capture-photo.is-primary { outline: 3px solid #e2a11b; outline-offset: 2px; }
.preview .media-primary-button,.capture-photo .media-primary-button {
  top: auto;
  right: 5px;
  bottom: 5px;
  left: 5px;
  z-index: 4;
  width: auto;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid #d9e2dd;
  border-radius: 7px;
  background: rgba(255,255,255,.94);
  color: #51635a;
  font-size: 9px;
  font-weight: 800;
  box-shadow: 0 2px 8px #0003;
}
.preview .media-primary-button.selected,.capture-photo .media-primary-button.selected { border-color: #e2a11b; background: #fff4d8; color: #8a5700; }
.preview .media-primary-button svg,.capture-photo .media-primary-button svg { width: 12px; height: 12px; fill: currentColor; }
.preview .media-rotate-button:hover,.capture-photo .media-rotate-button:hover { background: #e6f4ec; }
.preview .media-rotate-button:disabled,.capture-photo .media-rotate-button:disabled { cursor: wait; }
.heic-failed-preview {
  width: 100%;
  height: 100%;
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 14px;
  background: #fff1f1;
  color: #a32b2b;
  text-align: center;
}
.heic-failed-preview .lucide { width: 30px; height: 30px; }
.heic-failed-preview b { font-size: 11px; }
.heic-failed-preview small { max-width: 230px; color: #814a4a; font-size: 8px; line-height: 1.4; overflow-wrap: anywhere; }
@keyframes heic-conversion-progress {
  0% { left: -45%; }
  55% { left: 38%; }
  100% { left: 105%; }
}

.analysis-prerequisite-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px 12px;
  padding: 9px 11px;
  border: 1px solid #efd49b;
  border-radius: 8px;
  background: #fff8e8;
  color: #8b5a12;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
}
.analysis-prerequisite-alert .lucide { width: 15px; height: 15px; flex: 0 0 auto; }
.analysis-prerequisite-alert.hidden { display: none; }
.estimate-button.prerequisite-disabled {
  border-color: #dec58f;
  background: #fff8e8;
  color: #8b5a12;
  opacity: 1;
  cursor: pointer;
}
.estimate-button.prerequisite-disabled:hover { border-color: #cba85c; background: #fff1d3; }

@media (max-width: 720px) {
  .pack-lot-actions { justify-content: stretch; }
  .pack-lot-actions .btn { width: 100%; }
  .pack-items { grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); }
}

@media (max-width: 520px) {
  .pack-items { grid-template-columns: 1fr; padding: 12px; }
  .pack-item-actions > div { grid-template-columns: minmax(0,1fr) 38px minmax(0,.82fr); }
  .modal-actions .btn { flex: 1 1 150px; }
  .panel-head { align-items: flex-start; flex-direction: column; padding: 15px; }
  .panel-head .text-button { width: 100%; justify-content: center; }
}
