/* Espace expert — formulaire d'inspection (thème sombre, dakhel shell dyal admin.css) */
.view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.view > * { min-width: 0; } /* bla hadi, rapport A4 (794px) kaydfe3 l'écran f telephone */
.view[hidden], .pane[hidden] { display: none; }

.block {
  background: linear-gradient(180deg, rgba(18, 26, 60, .78), rgba(13, 20, 48, .78)); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.block h2 { margin: 0 0 12px; font-family: 'Sora', sans-serif; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.block h2 .ar { font-family: 'Cairo', sans-serif; direction: rtl; color: var(--cyan); font-weight: 700; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.form input, .form textarea {
  width: 100%; background: rgba(6, 10, 24, .6); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--text); outline: none;
}
.form input:focus, .form textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(55, 210, 230, .15); }
.form input[readonly] { opacity: .65; }
.form textarea { min-height: 60px; resize: vertical; margin-top: 10px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.row .name { font-weight: 600; font-size: 14px; }
.row .name small { display: block; color: var(--muted); font-family: 'Cairo', sans-serif; font-weight: 600; }
.seg { display: flex; flex-shrink: 0; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-left: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); padding: 8px 10px; min-width: 64px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text); }
.seg button.on.g { background: #16a34a; color: #fff; }
.seg button.on.y { background: #f2c94c; color: #3a3000; }
.seg button.on.r { background: #e9645b; color: #fff; }

.upload { display: inline-block !important; padding: 10px 14px; border: 1.5px dashed var(--cyan); border-radius: 10px; color: var(--cyan) !important; cursor: pointer; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs div { position: relative; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; display: block; }
.thumbs button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #e9645b; color: #fff; cursor: pointer; line-height: 1; }

/* Option cachet (switch) */
.form label.switch {
  flex-direction: row; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 12px; color: var(--text); font-size: 13.5px;
}
.form .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch .sw { position: relative; flex-shrink: 0; width: 44px; height: 26px; border-radius: 13px; background: #c6cddd; transition: background .15s; }
.switch .sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .sw { background: #16a34a; }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--cyan); outline-offset: 2px; }
.switch .txt { display: flex; flex-direction: column; gap: 2px; }
.switch .txt small { color: var(--muted); font-weight: 500; font-size: 12px; }
.switch img { height: 40px; margin-left: auto; opacity: .35; transition: opacity .15s; }
.switch input:checked ~ img { opacity: 1; }

.factions {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 0 14px;
  background: linear-gradient(rgba(6, 10, 24, 0), #060a18 40%);
}
.lock-note { font-size: 12px; color: var(--muted); }

/* Schéma tomobil f formulaire (dark) — rapport lui-même kaykhlli lwan dyalo */
.carmap-wrap { max-width: 340px; margin: 0 auto 14px; padding: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; }
.carmap-wrap .hint { color: var(--muted); }
.carmap-wrap .car-legend { color: var(--text-2); }
.carmap-wrap .carmap .wheel { fill: #4a5280; }
.carmap-wrap .carmap .axis text { fill: var(--muted); }
.carmap-wrap .carmap .plbl text { fill: #0b1128; opacity: .85; }
.readonly .carmap .part { pointer-events: none; cursor: default; }

/* Aperçu */
.preview { position: sticky; top: 16px; align-self: start; }
.preview-head { font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#status { color: var(--muted); font-weight: 500; font-size: 12.5px; margin-left: 6px; }
#report-wrap, .ro-wrap { border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); padding: 12px; overflow: auto; }
#report-wrap { max-height: calc(100vh - 150px); }
#report, #ro-report { transform-origin: top left; }
.design-switch { display: flex; gap: 3px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); padding: 3px; border-radius: 10px; }
.design-switch button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.design-switch button.on { background: linear-gradient(135deg, var(--indigo), var(--cyan)); color: #fff; }

/* Accueil expert */
.cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cta p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }

/* ---------- Nouvelle inspection: thème bayed (body.light) — menu f jnb kayb9a sombre ---------- */
body.light { background: #eef1f7; }
body.light::before { display: none; }
body.light .main {
  --text: #151a30; --text-2: #3d4466; --muted: #6b7292; --line: #e1e6f0; --line-2: #cfd6e4;
  color: var(--text); color-scheme: light;
}
body.light .block { background: #fff; box-shadow: 0 1px 3px rgba(20, 30, 60, .06); }
body.light .block h2 .ar { color: #4b5bd1; }
body.light .form input, body.light .form textarea { background: #fff; }
body.light .form input:focus, body.light .form textarea:focus { border-color: #6c7cf0; box-shadow: 0 0 0 3px rgba(108, 124, 240, .18); }
body.light .seg button { background: #fff; }
body.light .seg button:hover { background: #f3f5fa; }
body.light .upload { color: #3f4fc9 !important; border-color: #6c7cf0; }
body.light .btn { background: #fff; color: var(--text); }
body.light .btn:hover { background: #f3f5fa; }
body.light .btn.primary { color: #fff; background: linear-gradient(135deg, var(--indigo), #4f9df0 60%, var(--cyan)); }
body.light .burger { background: #fff; border-color: var(--line-2); }
body.light .factions { background: linear-gradient(rgba(238, 241, 247, 0), #eef1f7 40%); }
body.light #report-wrap { background: #e3e8f1; }
body.light .design-switch { background: #fff; }
body.light .carmap-wrap { background: #f7f8fc; }
body.light .carmap-wrap .carmap .wheel { fill: #2b3150; }
body.light .carmap-wrap .carmap .plbl text { fill: #1f2540; opacity: .75; }
body.light .switch { background: #fafbfe; }

.to-preview { display: none; }
.factions .short { display: none; }
.preview-head { flex-wrap: wrap; }

@media (max-width: 1250px) {
  .view { grid-template-columns: 1fr; }
  .preview { position: static; scroll-margin-top: 12px; }
  #report-wrap { max-height: none; }
  .to-preview { display: inline-flex; }
}
@media (max-width: 640px) {
  .form input, .form textarea { font-size: 16px; }
  .block { padding: 14px 12px; }
  .factions { gap: 6px; flex-wrap: nowrap; padding: 12px 0 10px; }
  .factions .btn { flex: 1 1 0; justify-content: center; padding: 10px 6px; font-size: 13px; }
  .factions .btn.primary { flex-grow: 1.4; }
  .factions .long, .lock-note { display: none; }
  .factions .short { display: inline; }
  #report-wrap, .ro-wrap { padding: 6px; border-radius: 10px; }
}
@media (max-width: 520px) {
  .row { flex-direction: column; align-items: stretch; gap: 8px; }
  .seg button { flex: 1; min-width: 0; padding: 10px 6px; }
  .carmap-wrap { padding: 8px; }
  .switch img { display: none; }
}
