/* VetrexTask – admin inspection and remote assistance ("Fernhilfe"): banners, step log (right drawer on desktop,
   bottom sheet on phones), highlight of the supporter's clicks, request dialog, logs in the admin panel.
   Colours come from the tokens in app.css (light and dark). */

/* ------------------------------------------------------------------ banners */
.assist-live { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--success); vertical-align: 1px;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); animation: assist-live 1.6s ease-out infinite; }
@keyframes assist-live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.assist-presence { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; line-height: 20px;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.assist-presence::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.assist-presence.on { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.assist-presence.on::before { background: var(--success); }
.shell-banner .btn-row { flex-wrap: wrap; }
.shell-banner .icon { vertical-align: -3px; }
.assist-banner-note { display: flex; gap: 6px; min-width: 0; }
.assist-banner-note .input { width: 260px; height: 26px; padding: 2px 8px; font-size: 12.5px; }
.act-as .shell-banner { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.act-inspect .shell-banner.warn { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); }
.assist-staff-banners { display: flex; flex-direction: column; }
.assist-staff-banners .shell-banner + .shell-banner { border-top: 0; }
.shell-banner.danger .icon { color: var(--danger); }
.shell-banner.warn .icon { color: var(--warning); }

/* Inspection is read only: no "+ Neu", no upload zone (other changes are refused with a notice) */
.act-inspect .top-new, .act-inspect .dropzone { display: none; }

/* ------------------------------------------------------------------ step log */
.assist-log { position: fixed; z-index: 40; right: 0; top: 0; bottom: 0; width: 340px; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0, 0, 0, .06); }
.assist-log-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 10px 16px; border-bottom: 1px solid var(--border); min-height: 52px; }
.assist-log-title { font-weight: 600; font-size: 13.5px; }
.assist-peek { display: none; font-size: 12px; color: var(--text-2); }
.assist-log-toggle .icon { transition: transform .15s; }
.assist-log-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 0 10px; }
.assist-log-status { margin: 8px 16px 0; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 12px; color: var(--text-2); }
.assist-log-status[hidden] { display: none; }
.assist-empty { padding: 14px 16px; color: var(--text-3); font-size: 12.5px; }
.assist-empty[hidden] { display: none; }
.assist-steps { list-style: none; margin: 0; padding: 0; }
.assist-step { display: flex; gap: 10px; padding: 8px 16px; font-size: 13px; line-height: 1.4; }
.assist-step + .assist-step { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.assist-step-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; background: var(--surface-2); color: var(--text-3); }
.assist-step.action .assist-step-icon { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.assist-step.nav .assist-step-icon { color: var(--accent); }
.assist-step.note { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.assist-step.note .assist-step-icon { background: var(--accent-fill); color: #fff; }
.assist-step.status { color: var(--text-2); }
.assist-step-text { overflow-wrap: anywhere; }
.assist-step.action .assist-step-text { font-weight: 500; }
.assist-step-tag { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 3px; font-size: 10.5px; font-weight: 600; line-height: 17px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); vertical-align: 1px; }
.assist-step-hint { margin-top: 4px; padding: 6px 8px; border-radius: var(--r-sm); font-size: 12px; color: var(--text-2); background: var(--surface-2); }
.assist-step-time { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }
.assist-note { display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.assist-note .input { flex: 1; min-width: 0; }

/* the page stays readable next to the open drawer */
@media (min-width: 641px) {
  .assist-log-open .app .main, .assist-log-open .assist-ended-page { margin-right: 340px; }
  .assist-log.collapsed { top: auto; bottom: 16px; right: 16px; width: 300px; border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop); }
  .assist-log.collapsed .assist-log-head { border-bottom: 0; cursor: pointer; }
  .assist-log.collapsed .assist-peek { display: block; }
  .assist-log.collapsed .assist-log-body, .assist-log.collapsed .assist-note { display: none; }
  .assist-log.collapsed .assist-log-toggle .icon { transform: rotate(180deg); }
  .assist-log:not(.collapsed) .assist-log-toggle .icon { transform: rotate(-90deg); }
}
@media (min-width: 641px) and (max-width: 1100px) {
  .assist-log:not(.collapsed) { width: 300px; }
  .assist-log-open .app .main, .assist-log-open .assist-ended-page { margin-right: 300px; }
}

/* phone: bottom sheet above the tab bar; collapsed it shows the latest step */
@media (max-width: 640px) {
  .assist-log { top: auto; left: 0; right: 0; width: auto; bottom: calc(62px + env(safe-area-inset-bottom)); max-height: 52vh; border-left: 0; border-top: 1px solid var(--border-strong);
    border-radius: 12px 12px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .12); }
  .assist-ended-page ~ .assist-log, body:not(:has(.tabbar)) .assist-log { bottom: 0; }
  .assist-log-head { min-height: 0; padding: 8px 8px 8px 14px; }
  .assist-log.collapsed .assist-log-head { border-bottom: 0; cursor: pointer; }
  .assist-log.collapsed .assist-peek { display: block; }
  .assist-log.collapsed .assist-log-body, .assist-log.collapsed .assist-note { display: none; }
  .assist-log:not(.collapsed) .assist-log-toggle .icon { transform: none; }
  .assist-log.collapsed .assist-log-toggle .icon { transform: rotate(180deg); }
  .assist-note { padding-bottom: 10px; }
  .assist-log-shown .content { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .assist-banner-note { flex: 1 1 100%; }
  .assist-banner-note .input { width: auto; flex: 1; height: 30px; }
}

/* ------------------------------------------------------------------ highlight of the supporter's click */
.assist-hl { outline: 3px solid var(--accent) !important; outline-offset: 2px; border-radius: var(--r-sm); animation: assist-hl 1.5s ease-out; }
@keyframes assist-hl {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .assist-hl { animation: none; }
  .assist-live { animation: none; }
  .assist-log-toggle .icon { transition: none; }
}

/* ------------------------------------------------------------------ live replica of the supporter's dialogs (customer)
   Own classes, not .backdrop/.modal: it never takes focus, Escape ignores it and findTarget() skips .assist-ui. */
.assist-mirror { position: fixed; z-index: 41; top: 84px; right: 16px; width: 360px; max-height: calc(100vh - 190px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-pop); animation: am-in .18s ease-out; }
.assist-log-open .assist-mirror { right: 356px; }
@keyframes am-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.am-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
.am-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.am-badge { flex: none; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 10px; font-size: 11.5px; line-height: 20px; white-space: nowrap;
  color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border)); }
.am-badge .assist-live { margin-right: 6px; }
.am-sub { margin: 0; padding: 0 14px 8px; font-size: 12px; color: var(--text-3); }
.am-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.am-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.am-label { font-size: 12px; font-weight: 600; color: var(--text-2); overflow-wrap: anywhere; }
.am-value { min-height: 34px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); font-size: 13.5px;
  line-height: 1.4; overflow-wrap: anywhere; cursor: default; }
.am-value.empty { color: var(--text-3); }
.am-value.multi { white-space: pre-wrap; max-height: 9em; overflow-y: auto; }
.am-value.masked { display: flex; align-items: center; gap: 8px; color: var(--text-3); letter-spacing: .1em; }
.am-check-row { flex-direction: row; align-items: center; gap: 9px; }
.am-check { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2); }
.am-check[role="radio"] { border-radius: 50%; }
.am-check.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.am-check-label { font-size: 13.5px; overflow-wrap: anywhere; }
.am-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 13px; color: var(--text-2); }
.am-note .icon { flex: none; margin-top: 2px; color: var(--accent); }
.am-notice { font-size: 12.5px; }
.am-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.am-foot .btn[disabled] { opacity: .7; cursor: default; }
.am-more { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.assist-mirror.chip { width: auto; max-width: calc(100vw - 32px); padding: 0; border-radius: 14px; box-shadow: var(--shadow-pop); }
.am-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; font-size: 12.5px; color: var(--text-2); }
.am-chip .icon { color: var(--accent); }
.assist-mirror.chip, .assist-mirror.chip .am-chip { max-height: none; }

/* phone: bottom sheet above the step log and the tab bar (--am-lift = height of the step log, set by assist-watch.js) */
@media (max-width: 640px) {
  .assist-mirror, .assist-log-open .assist-mirror { top: auto; left: 0; right: 0; width: auto; border-left: 0; border-right: 0; border-radius: 12px 12px 0 0;
    bottom: calc(62px + var(--am-lift, 52px) + env(safe-area-inset-bottom)); max-height: min(46vh, calc(100vh - 62px - var(--am-lift, 52px) - 150px - env(safe-area-inset-bottom))); }
  body:not(:has(.tabbar)) .assist-mirror { bottom: var(--am-lift, 52px); }
  .assist-mirror.chip, .assist-log-open .assist-mirror.chip { left: 12px; right: auto; bottom: calc(62px + var(--am-lift, 52px) + 8px + env(safe-area-inset-bottom)); border: 1px solid var(--border-strong); border-radius: 14px; }
  .am-value { font-size: 16px; } /* no zoom, readable */
}
@media (prefers-reduced-motion: reduce) { .assist-mirror { animation: none; } }

/* ------------------------------------------------------------------ request dialog (customer) */
.assist-ask-lead { font-size: 14.5px; margin-bottom: 10px; }
.assist-ask-msg { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-style: italic; overflow-wrap: anywhere; }
.assist-ask-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.assist-ask-list li { display: flex; gap: 9px; align-items: flex-start; }
.assist-ask-list .icon { margin-top: 2px; color: var(--accent); }

/* ------------------------------------------------------------------ staff side */
.assist-ended-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; text-align: center; }
.assist-ended-page .empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.assist-case-actions { margin-top: 10px; }
.assist-offer-text { margin: 0 0 12px; }
.assist-filter .input { width: min(340px, 100%); }
.assist-log-card { margin-bottom: 16px; }
.assist-steps-admin .assist-step { padding: 8px 4px; }
