/* Fahrzeug-Chat (vehicle-chat.js): Reiter in der Überführungszentrale. Baut auf .wm (workspace-modules.css) und den Lila-Tokens auf.
   Zwei Spalten ab 900 px (Fahrzeugliste links, Gespräch rechts); darunter zwei Ansichten mit Zurück (data-state list|chat).
   Dark Mode über html[data-workspace-theme="dark"]. Nur Bildschirm. */
@media screen {
  .vc { --vc-center-bg:var(--wm-accent); --vc-center-text:#fff; --vc-driver-bg:var(--wm-surface); --vc-tick:var(--wm-muted); --vc-tick-read:var(--wm-accent); --vc-new:#fbf5ff; --vc-priority:#b4432f; --vc-priority-soft:#fdeeea; --vc-online:#2f8a57;
    display:grid; grid-template-columns:minmax(300px,380px) minmax(0,1fr); gap:0; height:calc(100vh - 300px); min-height:520px; max-height:1100px;
    border:1px solid var(--wm-line); border-radius:12px; background:var(--wm-soft); box-shadow:var(--wm-shadow); overflow:hidden; }
  html[data-workspace-theme="dark"] .vc { --vc-center-bg:#4f2b63; --vc-center-text:#f8f1fc; --vc-tick-read:#deb6ef; --vc-new:#2f2436; --vc-priority:#f19b96; --vc-priority-soft:#4b2e2d; --vc-online:#8fd4a9; }
  .vc h1, .vc h2 { margin:0; font-weight:600; }
  .vc h1 { font-size:22px; line-height:1.2; }
  .vc h2 { font-size:16px; line-height:1.25; }
  .transfer-tabs [data-vc-tab] b { display:inline-block; min-width:18px; margin-left:6px; padding:0 5px; border-radius:999px; background:var(--wm-accent,#643182); color:#fff; font-size:11px; line-height:18px; text-align:center; }
  .transfer-tabs [data-vc-tab] b[hidden] { display:none; }

  /* Fahrzeugliste */
  .vc-list { display:flex; flex-direction:column; min-width:0; min-height:0; border-right:1px solid var(--wm-line); background:var(--wm-surface); }
  .vc-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:16px 16px 8px; }
  .vc-head .wm-eyebrow { margin-bottom:2px; }
  .vc-head small { display:block; margin-top:2px; font-size:12px; color:var(--wm-muted); }
  .vc-search { padding:0 16px 10px; }
  .vc-search-field { display:flex; align-items:center; gap:8px; height:36px; padding:0 11px; border:1px solid var(--wm-line); border-radius:8px; background:var(--wm-soft); color:var(--wm-muted); }
  .vc-search-field:focus-within { border-color:var(--wm-accent); box-shadow:0 0 0 2px rgba(100,49,130,.14); }
  .vc-search-field svg { width:15px; height:15px; flex-shrink:0; }
  .vc-search-field input { flex:1; min-width:0; border:0; background:transparent; font:inherit; color:var(--wm-text); outline:none; }
  .vc-rows { flex:1; margin:0; padding:0 8px 8px; list-style:none; overflow-y:auto; border-top:1px solid var(--wm-line); }
  .vc-rows li { min-width:0; }
  .vc-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; width:100%; padding:10px 10px; margin-top:6px; border:1px solid transparent; border-radius:10px; background:transparent; font:inherit; color:inherit; text-align:left; cursor:pointer; transition:background .15s, border-color .15s; }
  .vc-row:hover { background:var(--wm-soft); }
  .vc-row.active { border-color:var(--wm-line); background:var(--wm-tint); }
  .vc-row.unread strong, .vc-row.unread .vc-row-last { color:var(--wm-text); font-weight:650; }
  .vc-row-main { display:grid; gap:2px; min-width:0; }
  .vc-row-top { display:flex; align-items:baseline; justify-content:space-between; gap:8px; min-width:0; }
  .vc-row-top strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:600; font-size:14px; }
  .vc-row-top time { flex-shrink:0; font-size:11.5px; color:var(--wm-muted); font-variant-numeric:tabular-nums; }
  .vc-row small { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:11.5px; color:var(--wm-muted); }
  .vc-row-last { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:13px; color:var(--wm-muted); }
  .vc-row-last em { font-style:italic; color:var(--wm-accent); }
  .vc-you { color:var(--wm-muted); }
  .vc-unread { min-width:22px; height:22px; padding:0 6px; border-radius:999px; background:var(--wm-accent); color:#fff; font-size:12px; font-weight:700; line-height:22px; text-align:center; }
  .vc-empty { padding:24px 16px; color:var(--wm-muted); font-size:13.5px; text-align:center; }
  .vc-empty p { margin:0; }
  .vc-note { margin:0; padding:8px 16px 12px; border-top:1px solid var(--wm-line); font-size:11.5px; color:var(--wm-muted); }

  /* Kennzeichen-Plakette mit Online-Punkt */
  .vc-plate { position:relative; display:inline-flex; align-items:center; justify-content:center; min-width:64px; height:30px; padding:0 8px; border:1.5px solid var(--wm-text); border-radius:6px; background:var(--wm-surface); font-size:12.5px; font-weight:700; letter-spacing:.04em; color:var(--wm-text); white-space:nowrap; flex-shrink:0; }
  .vc-plate i { position:absolute; top:-5px; right:-5px; width:11px; height:11px; border:2px solid var(--wm-surface); border-radius:50%; background:var(--wm-muted); opacity:.45; }
  .vc-plate.online i { background:var(--vc-online); opacity:1; }
  .vc-online { color:var(--vc-online); font-weight:600; }

  /* Gespräch */
  .vc-chat { display:flex; flex-direction:column; min-width:0; min-height:0; background:var(--wm-soft); }
  .vc-blank { display:grid; place-content:center; justify-items:center; gap:8px; height:100%; padding:32px; text-align:center; color:var(--wm-muted); }
  .vc-blank-icon { display:inline-flex; width:56px; height:56px; align-items:center; justify-content:center; border-radius:50%; background:var(--wm-tint); color:var(--wm-accent); }
  .vc-blank-icon svg { width:26px; height:26px; }
  .vc-blank h2 { color:var(--wm-text); }
  .vc-blank p { max-width:380px; margin:0; font-size:13.5px; line-height:1.5; }
  .vc-chat-head { display:flex; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid var(--wm-line); background:var(--wm-surface); }
  .vc-back { display:none; padding:6px; }
  .vc-back svg { transform:rotate(180deg); }
  .vc-chat-title { flex:1; min-width:0; }
  .vc-chat-title h2 { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .vc-chat-title small { display:block; font-size:12px; color:var(--wm-muted); }
  .vc-typing { margin:2px 0 0; font-size:12px; font-style:italic; color:var(--wm-accent); }
  .vc-typing::after { content:""; display:inline-block; width:4px; height:4px; margin-left:4px; border-radius:50%; background:currentColor; animation:vc-blink 1s infinite; }
  @keyframes vc-blink { 50% { opacity:.2; } }
  .vc-chat-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
  .vc-chat-actions .button { height:30px; padding:0 10px; font-size:12.5px; }
  .vc-messages { flex:1; min-height:0; overflow-y:auto; padding:14px 18px; display:flex; flex-direction:column; gap:6px; }
  .vc-messages:focus-visible { outline-offset:-2px; }
  .vc-day { display:flex; align-items:center; gap:10px; margin:10px 0 6px; color:var(--wm-muted); font-size:11.5px; letter-spacing:.04em; text-transform:uppercase; }
  .vc-day::before, .vc-day::after { content:""; flex:1; height:1px; background:var(--wm-line); }
  .vc-more { margin:0 0 6px; text-align:center; font-size:11.5px; color:var(--wm-muted); }
  .vc-system { display:flex; justify-content:center; margin:4px 0; }
  .vc-system span { padding:4px 10px; border-radius:999px; background:var(--wm-tint); font-size:11.5px; color:var(--wm-muted); text-align:center; }
  .vc-bubble { position:relative; max-width:min(72%, 620px); padding:9px 12px 7px; border-radius:14px; box-shadow:var(--wm-shadow); font-size:14px; line-height:1.45; word-break:break-word; }
  .vc-bubble p { margin:0; white-space:pre-wrap; }
  .vc-bubble.driver { align-self:flex-start; border:1px solid var(--wm-line); border-bottom-left-radius:4px; background:var(--vc-driver-bg); color:var(--wm-text); }
  .vc-bubble.driver.new { background:var(--vc-new); }
  .vc-bubble.center { align-self:flex-end; border-bottom-right-radius:4px; background:var(--vc-center-bg); color:var(--vc-center-text); }
  .vc-bubble.pending { opacity:.7; }
  .vc-bubble.priority { border:2px solid var(--vc-priority); }
  .vc-bubble.center.priority { background:var(--vc-priority); }
  html[data-workspace-theme="dark"] .vc-bubble.center.priority { background:#7a3a31; }
  .vc-priority { display:inline-flex; align-items:center; gap:4px; margin-bottom:3px; padding:1px 7px; border-radius:999px; background:rgba(255,255,255,.22); font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
  .vc-bubble.driver .vc-priority { background:var(--vc-priority-soft); color:var(--vc-priority); }
  .vc-priority svg { width:12px; height:12px; }
  .vc-bubble-author { display:block; margin-bottom:2px; font-size:11.5px; font-weight:600; color:var(--wm-accent); }
  .vc-bubble.center .vc-bubble-author { color:inherit; opacity:.85; }
  .vc-ref { display:inline-flex; align-items:center; gap:5px; margin:0 0 5px; padding:2px 8px; border-radius:999px; border:1px solid rgba(255,255,255,.4); background:rgba(255,255,255,.14); font-size:11.5px; }
  .vc-bubble.driver .vc-ref { border-color:var(--wm-line); background:var(--wm-soft); color:var(--wm-accent); }
  .vc-ref svg { width:12px; height:12px; }
  .vc-bubble footer { display:flex; align-items:center; justify-content:flex-end; gap:6px; margin-top:4px; font-size:11px; opacity:.85; }
  .vc-bubble.driver footer { color:var(--wm-muted); }
  .vc-status { font-weight:700; letter-spacing:-.12em; color:var(--vc-tick); }
  .vc-bubble.center .vc-status { color:rgba(255,255,255,.8); }
  .vc-bubble.center .vc-status[data-status="read"] { color:#ffe9a8; }
  .vc-status.compact { font-size:12px; color:var(--vc-tick); }
  .vc-status.compact[data-status="read"] { color:var(--vc-tick-read); }
  .vc-read-by { font-style:italic; }
  .vc-photo { display:block; margin-top:6px; max-width:260px; border-radius:10px; overflow:hidden; border:1px solid rgba(255,255,255,.35); }
  .vc-bubble.driver .vc-photo { border-color:var(--wm-line); }
  .vc-photo img { display:block; width:100%; max-height:260px; object-fit:cover; }
  .vc-pending-photo { font-size:12.5px; opacity:.85; display:flex; align-items:center; gap:6px; }
  .vc-location { display:flex; align-items:center; gap:8px; margin-top:6px; padding:6px 9px; border:1px solid var(--wm-line); border-radius:10px; background:var(--wm-soft); font:inherit; color:var(--wm-text); text-align:left; cursor:pointer; }
  .vc-location:hover { border-color:var(--wm-accent); }
  .vc-location svg { width:18px; height:18px; color:var(--wm-accent); flex-shrink:0; }
  .vc-location span { display:grid; min-width:0; }
  .vc-location strong { font-size:13px; }
  .vc-location small { font-size:11.5px; color:var(--wm-muted); }
  .vc-empty-chat { margin:auto; max-width:380px; text-align:center; color:var(--wm-muted); font-size:13.5px; }

  /* Schreibfeld */
  .vc-compose { display:grid; gap:6px; padding:10px 14px 12px; border-top:1px solid var(--wm-line); background:var(--wm-surface); }
  .vc-compose-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .vc-quick { display:flex; flex-wrap:wrap; gap:6px; flex:1 1 100%; }
  .vc-chip { display:inline-flex; align-items:center; min-height:28px; padding:0 11px; border:1px solid var(--wm-border); border-radius:999px; background:var(--wm-surface); font:inherit; font-size:12.5px; color:var(--wm-text); cursor:pointer; transition:background .15s,border-color .15s; }
  .vc-chip:hover { background:var(--wm-tint); border-color:var(--wm-accent); }
  .vc-tool { display:inline-flex; align-items:center; gap:6px; height:28px; padding:0 9px; border:1px solid var(--wm-line); border-radius:7px; background:var(--wm-surface); font:inherit; font-size:12px; color:var(--wm-text); cursor:pointer; }
  .vc-tool svg { width:14px; height:14px; color:var(--wm-muted); }
  .vc-tool select { max-width:260px; border:0; background:transparent; font:inherit; font-size:12px; color:var(--wm-text); outline:none; }
  .vc-attach.has-file { border-color:var(--wm-accent); background:var(--wm-tint); }
  .vc-attach span { max-width:160px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .vc-photo-clear { padding:0 6px; }
  .vc-priority-toggle input { position:absolute; width:1px; height:1px; margin:-1px; opacity:0; pointer-events:none; }
  .vc-priority-toggle.on { border-color:var(--vc-priority); background:var(--vc-priority-soft); color:var(--vc-priority); }
  .vc-priority-toggle.on svg { color:var(--vc-priority); }
  .vc-priority-toggle:has(input:focus-visible) { outline:2px solid var(--wm-accent); outline-offset:2px; }
  .vc-hint { margin-left:auto; font-size:11px; color:var(--wm-muted); }
  .vc-compose-row { display:flex; align-items:flex-end; gap:8px; }
  .vc-compose textarea { flex:1; min-height:40px; max-height:170px; padding:9px 12px; border:1px solid var(--wm-line); border-radius:12px; background:var(--wm-soft); font:inherit; font-size:14px; line-height:1.4; color:var(--wm-text); resize:none; }
  .vc-compose textarea:focus { border-color:var(--wm-accent); outline:none; box-shadow:0 0 0 2px rgba(100,49,130,.14); }
  .vc-send { width:40px; height:40px; padding:0; border-radius:50%; justify-content:center; }
  .vc-send svg { width:18px; height:18px; }
  .vc-sr { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

  /* Foto groß */
  .vc-lightbox { position:fixed; inset:0; z-index:1200; display:grid; place-content:center; justify-items:center; gap:12px; padding:24px; background:rgba(20,14,24,.88); }
  .vc-lightbox img { max-width:min(96vw, 1400px); max-height:80vh; border-radius:10px; box-shadow:0 10px 40px rgba(0,0,0,.4); }
  .vc-lightbox-close { position:absolute; top:16px; right:16px; width:40px; height:40px; border:0; border-radius:50%; background:rgba(255,255,255,.14); color:#fff; cursor:pointer; display:grid; place-content:center; }
  .vc-lightbox-close svg { width:18px; height:18px; }

  /* Einstellungen (Dialog) */
  .vc-settings-form { display:grid; gap:12px; }
  .vc-settings-form textarea { width:100%; font:inherit; }

  @media (max-width: 899px) {
    .vc { grid-template-columns:1fr; height:calc(100vh - 230px); min-height:460px; border-radius:10px; }
    .vc-list { border-right:0; }
    .vc[data-state="list"] .vc-chat, .vc[data-state="chat"] .vc-list { display:none; }
    .vc-back { display:inline-flex; }
    .vc-chat-head { flex-wrap:wrap; padding:10px 12px; }
    .vc-chat-actions { width:100%; justify-content:flex-start; }
    .vc-chat-actions .button span { display:none; }
    .vc-messages { padding:10px 12px; }
    .vc-bubble { max-width:86%; }
    .vc-compose { padding:8px 10px 10px; }
    .vc-hint { display:none; }
    .vc-tool select { max-width:150px; }
    .vc-photo { max-width:100%; }
  }
}
