/* ============================================================
   Viewer-Styles (public/src/viewers/*) — nutzt die Design-Tokens
   aus style.css; Light-Theme funktioniert automatisch über Tokens.
   Container ist #content (position:relative, overflow:auto):
   Vollflächen-Viewer setzen position:absolute+inset:0, Dokument-
   Viewer fließen normal und lassen #content scrollen.
   ============================================================ */

/* ===== Gemeinsames: Fehler, Laden, Frames, Toolbars ===== */
.v-error {
  max-width: 560px; margin: 48px auto; padding: 16px 20px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--err); border-radius: var(--radius);
  font-size: 13.5px; word-break: break-word;
}
.v-loading {
  padding: 48px 20px; text-align: center; color: var(--muted);
  font-size: 13.5px; animation: v-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes v-pulse { from { opacity: .55 } to { opacity: 1 } }
.v-download-link { display: inline-block; margin-top: 12px; text-decoration: none; }

.v-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

.v-code-head, .v-csv-bar, .v-html-bar, .v-epub-bar, .v-gpx-head {
  display: flex; align-items: center; gap: 10px; min-height: 40px;
  padding: 4px 12px; background: var(--panel); border-bottom: 1px solid var(--line);
  font-size: 13px; flex-shrink: 0;
}
.v-code-spacer, .v-html-spacer, .v-epub-spacer { flex: 1; }

.v-truncate-note {
  padding: 7px 14px; font-size: 12.5px; color: var(--warn);
  background: rgba(245, 185, 65, .08); border-bottom: 1px solid var(--line);
}

/* ===== Text-Editor (viewers/text.js) — liniertes Papier ===== */
.v-text { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-text-scroll { flex: 1; overflow: auto; padding: 24px 16px 0; }
.v-text-page {
  position: relative; display: flex;
  max-width: 920px; margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  /* Linien-Raster: alle 32px eine Linie (= line-height von Gutter & Textarea) */
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent 31px, var(--line) 31px, var(--line) 32px);
}
.v-text-gutter {
  width: 56px; flex-shrink: 0;
  padding: 32px 12px 48px 0;
  font-size: 12px; line-height: 32px; text-align: right; white-space: pre;
  color: var(--muted); font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--line);
  user-select: none; overflow: hidden;
}
.v-text-area {
  flex: 1; min-width: 0;
  padding: 32px 28px 48px 22px;
  background: transparent; border: 0; outline: none; resize: none;
  color: var(--text); caret-color: var(--accent);
  font: 15px/32px system-ui, -apple-system, 'Segoe UI', sans-serif;
  white-space: pre-wrap; word-break: break-word; overflow: hidden;
}
.v-text-mono .v-text-area {
  font: 13.5px/32px ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  tab-size: 4;
}
@media (max-width: 768px) {
  .v-text-scroll { padding: 0; }
  .v-text-page { border-radius: 0; border-left: 0; border-right: 0; }
  .v-text-area { padding: 32px 14px 48px 10px; }
  .v-text-gutter { width: 40px; padding-right: 8px; }
}

/* ===== Medien (viewers/media.js) ===== */
.v-media-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; }
/* overflow hidden: Zoom/Pan laufen als Transform (view-transform.js), nicht
   mehr über Scrollen. */
.v-img-stage { flex: 1; overflow: hidden; display: flex; min-height: 0; }
/* .v-img-box umhüllt das Bild als Anker für die Stift-Annotations-Ebene.
   Wichtig: Die Bildhöhe NICHT in % gegen den shrink-wrappenden Wrapper
   begrenzen (kollabiert auf 0) — stattdessen Viewport-relativ deckeln. */
.v-img-stage .v-img-box {
  position: relative; margin: auto; line-height: 0; max-width: 100%;
}
.v-img-stage img {
  display: block; max-width: 100%;
  max-height: calc(100dvh - var(--topbar-h) - 150px);
  object-fit: contain; cursor: zoom-in;
}
.v-img-stage img.zoomed { max-width: none; max-height: none; cursor: zoom-out; }
.v-img-stage .v-img-box:has(img.zoomed) { max-width: none; margin: 0; }
/* Einheitliche untere Leiste für Bild/Video/PDF (viewers/media-bar.js). */
.v-media-bar {
  height: 42px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; gap: 10px; padding: 0 12px;
  background: var(--panel); border-top: 1px solid var(--line); font-size: 13px;
}
.v-media-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
.v-media-counter { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.v-media-tools { display: inline-flex; align-items: center; gap: 8px; }

.v-audio-view { align-items: center; justify-content: center; }
.v-audio-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px 42px; box-shadow: var(--shadow); max-width: min(480px, 92%);
}
.v-audio-icon { font-size: 46px; }
.v-audio-title { font-weight: 600; text-align: center; word-break: break-word; }
.v-audio-card audio { width: min(380px, 78vw); }
.v-audio-skiprow { display: flex; gap: 10px; }
.v-audio-skip {
  display: inline-flex; align-items: center; gap: 4px;
  width: auto; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); font-weight: 600; font-size: 13px;
}
.v-audio-skip svg { width: 16px; height: 16px; }

.v-video-stage {
  flex: 1; min-height: 0; display: flex; align-items: center;
  justify-content: center; overflow: hidden; touch-action: none;
}
.v-video-stage video {
  max-width: 100%; max-height: 100%; width: 100%; background: #000;
  object-fit: contain; will-change: transform;
}

/* ---- Ansichts-Transform (Bild/Video): Zoom, Pan, Rotation ---- */
.v-img-stage { touch-action: none; }
.v-img-box { will-change: transform; }
.v-tf-smooth { transition: transform .22s ease; }
.v-tf-pannable { cursor: grab; }

/* ===== PDF (viewers/pdf.js) ===== */
/* iframe füllt den Raum über der einheitlichen unteren Leiste (.v-media-wrap
   ist Flex-Spalte). PDF.js' eigene Toolbar bleibt oben im iframe. */
.v-pdf { flex: 1; min-height: 0; width: 100%; border: 0; }

/* Status-Pille der AcroForm-Formularfelder (nur sichtbar, wenn das PDF welche
   hat). Farbe signalisiert Speicherzustand. */
.v-pdf-form-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 1;
  background: color-mix(in srgb, var(--viz-1, #3987e5) 14%, transparent);
  color: var(--viz-1, #3987e5);
  border: 1px solid color-mix(in srgb, var(--viz-1, #3987e5) 30%, transparent);
}
.v-pdf-form-status::before { content: '📝'; font-size: 12px; }
.v-pdf-form-status.is-busy { background: color-mix(in srgb, var(--viz-3, #c98500) 16%, transparent); color: var(--viz-3, #c98500); border-color: color-mix(in srgb, var(--viz-3, #c98500) 34%, transparent); }
.v-pdf-form-status.is-ok   { background: color-mix(in srgb, var(--viz-2, #199e70) 16%, transparent); color: var(--viz-2, #199e70); border-color: color-mix(in srgb, var(--viz-2, #199e70) 34%, transparent); }
.v-pdf-form-status.is-err  { background: color-mix(in srgb, var(--viz-6, #e66767) 16%, transparent); color: var(--viz-6, #e66767); border-color: color-mix(in srgb, var(--viz-6, #e66767) 34%, transparent); }
.v-pdf-form-status.is-ro   { opacity: .8; }
.v-pdf-form-status.is-ok::before   { content: '✓'; }
.v-pdf-form-status.is-err::before  { content: '⚠'; }
.v-pdf-form-status.is-ro::before   { content: '🔒'; }

/* Download-Button (mit Notizen) — Breite stabil halten, während der Fortschritt
   in Prozent im Label läuft; im Busy-Zustand dezent gedimmt. */
.v-pdf-download { white-space: nowrap; }
.v-pdf-download.busy { opacity: .7; pointer-events: none; }

/* Rand-Wisch-Streifen für fremde iframes (Excel/OnlyOffice) — nur Touch,
   transparent, fangen die horizontale Wische zum Ordner-Blättern ab. */
.so-edge-nav {
  position: absolute; top: 0; bottom: 0; width: 26px; z-index: 6;
  background: transparent; touch-action: pan-y;
}
.so-edge-left { left: 0; }
.so-edge-right { right: 0; }

/* ===== Code (viewers/code.js) ===== */
.v-code { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-code-lang {
  font: 600 11px/1 ui-monospace, monospace; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent);
  background: var(--accent-dim); padding: 4px 8px; border-radius: 6px;
}
.v-code-stats { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.v-code-edit { padding: 4px 11px; font-size: 12.5px; }
.v-code-body { flex: 1; display: flex; overflow: auto; align-items: flex-start; }
.v-code-ln, .v-code-src {
  margin: 0; font: 13px/1.55 ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
}
.v-code-ln {
  position: sticky; left: 0; flex-shrink: 0; min-width: 48px;
  padding: 14px 10px 28px 14px; text-align: right;
  color: var(--muted); background: var(--bg);
  border-right: 1px solid var(--line); user-select: none;
  font-variant-numeric: tabular-nums;
}
.v-code-src { flex: 1; padding: 14px 18px 28px; tab-size: 4; }
.tok-kw { color: var(--accent); font-weight: 600; }
.tok-str { color: var(--ok); }
.tok-num { color: var(--warn); }
.tok-com { color: var(--muted); font-style: italic; }
.tok-lit { color: #c586c0; }
[data-theme="light"] .tok-lit { color: #8a3fd6; }
.tok-ins { color: var(--ok); background: rgba(63, 207, 142, .09); display: inline-block; width: 100%; }
.tok-del { color: var(--err); background: rgba(255, 93, 93, .09); display: inline-block; width: 100%; }

/* ===== CSV/TSV (viewers/csv.js) + gemeinsame Tabellen ===== */
.v-csv { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-csv-name { font-weight: 600; }
.v-csv-meta { color: var(--muted); font-size: 12px; }
.v-csv .v-table-wrap { flex: 1; }

.v-table-wrap { overflow: auto; }
.v-table-wrap table {
  border-collapse: collapse; min-width: 100%; width: max-content; font-size: 13px;
}
.v-table-wrap th, .v-table-wrap td {
  border: 1px solid var(--line); padding: 5px 10px; text-align: left;
  max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-table-wrap th {
  position: sticky; top: 0; z-index: 2; background: var(--panel2);
  font-weight: 600; box-shadow: 0 1px 0 var(--line);
}
.v-table-wrap tbody tr:hover td { background: var(--panel); }
.v-csv-rownum {
  color: var(--muted); text-align: right; font-variant-numeric: tabular-nums;
  background: var(--panel); user-select: none;
}

/* ===== HTML (viewers/html.js) ===== */
.v-html { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-html-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-html-hint { color: var(--muted); font-size: 11.5px; }
.v-html-pdf { padding: 4px 11px; font-size: 12.5px; }
.v-html-frame { flex: 1; min-height: 0; }

/* ===== Web-Ansicht (viewers/weblink.js) ===== */
.v-web { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-web-bar {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.v-web-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-web-badge {
  font-size: 11px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; flex: none;
}
.v-web-viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #fff; }
.v-web-frame { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform-origin: top left; }
.ico-web { color: #5b9dff; }

/* Overlay, wenn die Zielseite das Einbetten verbietet (Probe, weblink.js) */
.v-web-blocked {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: var(--bg);
}
.v-web-blocked-card { max-width: 480px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.v-web-blocked-card p { margin: 0; font-size: 14px; line-height: 1.5; }
.v-web-blocked-card code { font-size: 12px; background: var(--panel2); padding: 1px 5px; border-radius: 5px; }
.v-web-blocked-h { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600; }
.v-web-blocked-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

.v-web-editwrap { overflow: auto; }
.v-web-edit { max-width: 560px; margin: 6vh auto; padding: 0 20px; display: flex; flex-direction: column; gap: 6px; }
.v-web-eh { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 20px; }
.v-web-edit .field-label { margin-top: 8px; }
.v-web-modes { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.v-web-mode { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text); cursor: pointer; }
.v-web-mode input { margin-top: 3px; flex: none; }
.v-web-actions { display: flex; gap: 8px; margin-top: 14px; }
.v-web-hint { margin-top: 12px; font-size: 12px; line-height: 1.5; }

/* Ordner-Navigator im "Als PDF speichern"-Dialog */
.pdf-pick-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pdf-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13px; }
.pdf-crumb {
  background: none; border: none; cursor: pointer; color: var(--accent);
  padding: 2px 5px; border-radius: 6px; font: inherit;
}
.pdf-crumb:hover { background: var(--accent-dim); }
.pdf-sep { color: var(--muted); }
.pdf-pick-list {
  max-height: 46vh; min-height: 120px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px;
}
.pdf-dir-row .fv-row-size { display: inline-flex; align-items: center; width: auto; color: var(--muted); }
.pdf-pick-foot { margin-top: 12px; }
.pdf-pick-foot .field-label { display: block; margin-bottom: 6px; }

/* ===== Binary / Hex (viewers/binary.js) ===== */
.v-binary { max-width: 880px; margin: 0 auto; padding: 28px 18px 70px; }
.v-bin-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
}
.v-bin-icon { font-size: 34px; margin-bottom: 8px; }
.v-bin-title { font-size: 16px; font-weight: 600; word-break: break-all; }
.v-bin-sub { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.v-bin-sub b { color: var(--text); }
.v-bin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.v-bin-actions a { text-decoration: none; display: inline-block; }
.v-hex {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.v-hex-meta {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.v-hex-meta b { color: var(--text); }
.v-hex-pre {
  margin: 0; padding: 12px 14px; overflow-x: auto;
  font: 12.5px/1.55 ui-monospace, Consolas, monospace;
}
.v-hex-pre .off { color: var(--muted); }
.v-hex-pre .asc { color: var(--accent); }
.v-hex-more { margin: 0 14px 14px; padding: 5px 12px; font-size: 12.5px; }

/* ===== Formular-Builder (viewers/form.js) ===== */
.form-view { max-width: 780px; margin: 0 auto; padding: 20px 16px 90px; }
.form-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.form-tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 9px 14px; cursor: pointer; color: var(--muted); font-size: 13.5px;
}
.form-tab:hover { color: var(--text); }
.form-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.form-builder .form-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.form-builder .form-description { margin-bottom: 18px; resize: vertical; }
.form-fields { display: flex; flex-direction: column; gap: 12px; }
.form-field-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.form-field-card.form-field-dragging { opacity: .45; }
.form-field-card.form-field-drop { border-color: var(--accent); }
.form-field-head { display: flex; align-items: center; gap: 8px; }
.form-field-drag { cursor: grab; color: var(--muted); padding: 2px 4px; user-select: none; }
.form-field-drag:hover { color: var(--text); }
.form-field-drag:active { cursor: grabbing; }
.form-field-label {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); padding: 7px 10px; outline: none; font: inherit;
}
.form-field-label:focus { border-color: var(--accent); }
.form-field-type {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 7px 8px; font: inherit; outline: none;
}
.form-field-delete {
  background: none; border: 0; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 0 6px; border-radius: 6px;
}
.form-field-delete:hover { color: var(--err); background: var(--panel2); }
.form-field-placeholder {
  width: 100%; margin-top: 8px; background: var(--bg); border: 1px dashed var(--line);
  border-radius: 8px; color: var(--muted); padding: 6px 10px; outline: none; font: inherit;
}
.form-field-placeholder:focus { border-color: var(--accent); color: var(--text); }
.form-field-options { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.form-field-option { display: flex; align-items: center; gap: 8px; }
.form-field-option-label {
  flex: 1; background: none; border: 0; border-bottom: 1px solid transparent;
  color: var(--text); padding: 4px 2px; outline: none; font: inherit;
}
.form-field-option-label:hover, .form-field-option-label:focus { border-bottom-color: var(--line); }
.form-field-option-remove {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 15px; padding: 0 5px; border-radius: 5px; opacity: 0;
}
.form-field-option:hover .form-field-option-remove { opacity: 1; }
.form-field-option-remove:hover { color: var(--err); }
.form-field-option-add {
  align-self: flex-start; margin-top: 8px; background: none; border: 0;
  color: var(--accent); cursor: pointer; font-size: 13px; padding: 2px 0;
}
.form-field-option-add:hover { text-decoration: underline; }
.form-field-required {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; width: fit-content;
}
.form-add-field { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.form-add-field-btn {
  background: var(--panel2); border: 1px dashed var(--line); border-radius: 8px;
  color: var(--muted); padding: 7px 12px; cursor: pointer; font-size: 13px;
}
.form-add-field-btn:hover { color: var(--accent); border-color: var(--accent); }

.form-preview-title { margin: 0 0 6px; font-size: 21px; }
.form-preview-desc { color: var(--muted); margin: 0 0 18px; white-space: pre-wrap; }
.form-preview-empty { color: var(--muted); }
.form-preview-field {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.form-preview-label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.form-preview-label .req { color: var(--err); }
.form-preview-field textarea { resize: vertical; }
.form-preview-option { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.form-preview-option input { accent-color: var(--accent); }
.form-preview-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.form-submit-status { color: var(--ok); font-size: 13px; }

.form-answers { display: flex; flex-direction: column; gap: 12px; }
.form-answers-empty { margin: 60px auto; text-align: center; color: var(--muted); }
.form-answers-actions { display: flex; justify-content: flex-end; }
.form-answer-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px;
}
.form-answer-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.form-answer-num { font-weight: 600; }
.form-answer-date { color: var(--muted); font-size: 12.5px; flex: 1; }
.form-answer-delete {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 17px; padding: 0 5px; border-radius: 5px;
}
.form-answer-delete:hover { color: var(--err); background: var(--panel2); }
.form-answer-card dl {
  display: grid; grid-template-columns: minmax(110px, 190px) 1fr;
  gap: 6px 12px; margin: 0;
}
.form-answer-card dt { color: var(--muted); font-size: 13px; }
.form-answer-card dd { margin: 0; word-break: break-word; font-size: 13.5px; }

/* ===== Archiv (viewers/archive.js) ===== */
.v-archive { max-width: 880px; margin: 0 auto; padding: 26px 18px 80px; }
.v-arch-head { margin-bottom: 16px; }
.v-arch-title { font-size: 17px; font-weight: 600; word-break: break-all; }
.v-arch-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.v-arch-tree {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px; font-size: 13px;
}
.v-arch-dir > summary {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px;
  border-radius: 7px; cursor: pointer; user-select: none; list-style: none;
}
.v-arch-dir > summary::-webkit-details-marker { display: none; }
.v-arch-dir > summary::before { content: '▸'; color: var(--muted); font-size: 10px; width: 10px; }
.v-arch-dir[open] > summary::before { content: '▾'; }
.v-arch-dir > summary:hover { background: var(--panel2); }
.v-arch-children { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 8px; }
.v-arch-row {
  display: flex; align-items: center; gap: 8px; padding: 3px 6px 3px 24px;
  border-radius: 7px;
}
.v-arch-row:hover { background: var(--panel2); }
.v-arch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-arch-date { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.v-arch-size {
  color: var(--muted); font-size: 12px; min-width: 70px; text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.v-arch-dl { font-size: 13px; padding: 2px 6px; }

/* ===== EPUB (viewers/epub.js) ===== */
.v-epub { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-epub-title {
  font-weight: 600; max-width: 30%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.v-epub-toc { width: auto; max-width: 280px; padding: 5px 8px; font-size: 12.5px; }
.v-epub-progress { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.v-epub-prev, .v-epub-next { padding: 4px 11px; font-size: 12.5px; }
.v-epub-reader { flex: 1; min-height: 0; position: relative; background: #fff; }

/* ===== Font-Preview (viewers/font.js) ===== */
.v-font { max-width: 980px; margin: 0 auto; padding: 0 0 90px; }
.v-font-head { padding: 24px 26px 18px; border-bottom: 1px solid var(--line); }
.v-font-title { font-size: 22px; font-weight: 600; word-break: break-all; }
.v-font-sub {
  color: var(--muted); font-size: 12.5px; margin-top: 4px;
  font-family: system-ui, sans-serif;
}
.v-font-body { padding: 24px 26px; }
.v-font-line { display: flex; align-items: baseline; gap: 14px; margin: 0 0 16px; line-height: 1.15; word-break: break-word; }
.v-font-sz {
  flex-shrink: 0; width: 26px; text-align: right; color: var(--muted);
  font: 11px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums;
}
.v-font-sample {
  margin: 18px 0 8px; padding: 16px 18px; font-size: 26px; line-height: 1.4;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); outline: none; white-space: pre-wrap;
}
.v-font-sample:focus { border-color: var(--accent); }
.v-font-h3 {
  margin: 28px 0 6px; font: 600 12px/1 system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.v-font-group-label {
  margin: 14px 0 6px; color: var(--muted);
  font: 12px/1 system-ui, sans-serif;
}
.v-font-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.v-font-cell {
  width: 44px; height: 52px; display: grid; place-items: center; font-size: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}

/* ===== Daten-Viewer gemeinsam (ICS, VCF) ===== */
.v-data { max-width: 880px; margin: 0 auto; padding: 26px 18px 80px; }
.v-data > h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; word-break: break-all; }
.v-data-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* ICS */
.v-ics-month {
  margin: 22px 0 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
}
.v-ics-event {
  display: flex; gap: 14px; padding: 10px 12px; margin-bottom: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.v-ics-when { flex-shrink: 0; width: 200px; color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.v-ics-main { flex: 1; min-width: 0; }
.v-ics-title { font-weight: 600; font-size: 13.5px; }
.v-ics-loc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.v-ics-desc {
  color: var(--muted); font-size: 12.5px; margin-top: 5px; white-space: pre-wrap;
  max-height: 80px; overflow: hidden;
}
@media (max-width: 768px) {
  .v-ics-event { flex-direction: column; gap: 4px; }
  .v-ics-when { width: auto; }
}

/* VCF */
.v-vcf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.v-vcf-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.v-vcf-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.v-vcf-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--panel2);
}
.v-vcf-initials {
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  color: var(--accent); background: var(--accent-dim);
}
.v-vcf-id { min-width: 0; }
.v-vcf-name { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.v-vcf-org { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.v-vcf-rows { display: flex; flex-direction: column; gap: 5px; }
.v-vcf-row { display: flex; gap: 8px; font-size: 13px; align-items: baseline; }
.v-vcf-ico { flex-shrink: 0; font-size: 12px; }
.v-vcf-val { min-width: 0; word-break: break-word; white-space: pre-wrap; }
.v-vcf-val a { color: var(--accent); text-decoration: none; }
.v-vcf-val a:hover { text-decoration: underline; }
.v-vcf-type {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  background: var(--panel2); border-radius: 5px; padding: 1px 5px;
}

/* ===== GPX/KML-Karte (viewers/gpx.js) ===== */
.v-gpx { max-width: 1100px; margin: 0 auto; padding: 14px 16px 70px; }
.v-gpx-head {
  background: none; border-bottom: 0; padding: 4px 2px 10px; min-height: 0;
}
.v-gpx-name { font-weight: 600; }
.v-gpx-stats { color: var(--muted); font-size: 12.5px; }
.v-gpx-map {
  position: relative; height: min(64vh, 560px);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #dcd8d0;
}
.v-gpx-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: grab; touch-action: none; display: block;
}
.v-gpx-canvas.dragging { cursor: grabbing; }
.v-gpx-zoom {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
}
.v-gpx-zoom .btn {
  width: 32px; height: 32px; padding: 0; font-size: 16px; line-height: 1;
  background: var(--panel); box-shadow: var(--shadow);
}
.v-gpx-attrib {
  position: absolute; bottom: 0; right: 0; z-index: 5;
  background: rgba(255,255,255,.75); color: #333;
  font-size: 10.5px; padding: 2px 7px; border-top-left-radius: 6px;
}
.v-gpx-table { margin-top: 14px; max-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); }

/* ===== Dokument-Papier (viewers/rtf.js, docx.js) ===== */
.v-doc { padding: 26px 16px 90px; }
.v-doc-note {
  max-width: 820px; margin: 0 auto 12px; text-align: center;
  color: var(--muted); font-size: 12px;
}
.v-doc-paper {
  max-width: 820px; margin: 0 auto; min-height: 500px;
  background: #fff; color: #1b1b1f;
  padding: 56px 64px; border-radius: 4px; box-shadow: var(--shadow);
  font-size: 15px; line-height: 1.65; overflow-wrap: break-word;
}
.v-doc-pre { white-space: pre-wrap; font-size: 14px; }
.v-doc-paper a { color: #2f6fde; }
.v-doc-paper img { max-width: 100%; height: auto; display: block; margin: 1em auto; }
.v-doc-paper table { border-collapse: collapse; margin: 1em 0; }
.v-doc-paper th, .v-doc-paper td { border: 1px solid #d8d8de; padding: 6px 10px; }
.v-doc-paper h1 { font-size: 1.7em; margin: 0 0 .4em; }
.v-doc-paper h2 { font-size: 1.4em; margin: 1em 0 .35em; }
.v-doc-paper h3 { font-size: 1.15em; margin: .85em 0 .3em; }
.v-doc-paper p { margin: .55em 0; }
@media (max-width: 768px) {
  .v-doc { padding: 12px 0 60px; }
  .v-doc-paper { padding: 28px 20px; border-radius: 0; }
}

/* ===== Tabellenkalkulation (viewers/sheet.js) ===== */
.v-sheet { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-tabs {
  display: flex; gap: 2px; padding: 6px 8px 0; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: thin;
}
.v-tabs button {
  background: var(--panel2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 8px 8px 0 0; padding: 6px 14px; cursor: pointer;
  color: var(--muted); font-size: 12.5px; white-space: nowrap; flex-shrink: 0;
}
.v-tabs button:hover { color: var(--text); }
.v-tabs button.on { background: var(--bg); color: var(--accent); border-color: var(--accent-dim); font-weight: 600; }
.v-sheet-body { flex: 1; overflow: auto; }
.v-sheet-body table { border-collapse: collapse; font-size: 13px; }
.v-sheet-body td, .v-sheet-body th {
  border: 1px solid var(--line); padding: 4px 9px; min-width: 60px;
  max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-sheet-body tr:first-child td { background: var(--panel2); font-weight: 600; }

/* ===== Photopea & OnlyOffice (Vollflächen-iframes) ===== */
.v-photopea { position: absolute; inset: 0; }
.v-office { position: absolute; inset: 0; }
.v-office > div, .v-office iframe { width: 100%; height: 100%; border: 0; }

/* ===== Stift-Annotation (Bilder & PDF) ===== */
.v-img-box { position: relative; display: inline-block; line-height: 0; }
.so-ink-tools { display: inline-flex; gap: 3px; margin-left: 12px; align-items: center; }
.so-ink-tools button {
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--muted); cursor: pointer; padding: 3px 7px; line-height: 1;
}
.so-ink-tools button:hover { background: var(--panel2); color: var(--text); }
.so-ink-tools button.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.so-ink-tools button svg.ico { width: 14px; height: 14px; }
.so-ink-tools input[type="color"] { width: 22px; height: 20px; border: 0; background: none; padding: 0; cursor: pointer; }

/* ---- Mobil: einheitliche Leiste bricht sauber um (Werkzeuge eigene Zeile) ---- */
@media (max-width: 768px) {
  .v-media-bar { flex-wrap: wrap; row-gap: 4px; }
  .v-media-tools { order: 9; width: 100%; justify-content: center; }
  .v-media-tools .so-ink-tools { margin-left: 0; }
}

/* ===== Mini-Tool (.tool) ===== */
.v-tool { position: absolute; inset: 0; display: flex; flex-direction: column; }
.v-tool-frame { flex: 1; width: 100%; border: 0; background: #fff; }
/* KEIN position:relative auf .v-tool-use — das überschriebe das absolute inset:0
   von .v-tool (spätere gleich-spezifische Regel) und ließe das iframe auf ~150px
   kollabieren. .v-tool ist bereits positioniert = Anker fürs .v-tool-empty-Overlay. */
.v-tool-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.v-tool-empty-card {
  pointer-events: auto; text-align: center; max-width: 22rem; padding: 24px 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.v-tool-empty-card .ico { width: 32px; height: 32px; color: var(--ico-tool, #c07de0); }
.v-tool-empty-card h2 { margin: 8px 0 4px; font-size: 17px; }
.v-tool-empty-card .btn { margin-top: 12px; }

/* Bauen-Modus: Vorschau links, Panel rechts */
.v-tool-build { flex-direction: row; }
.v-tool-preview { flex: 1 1 60%; display: flex; flex-direction: column; min-width: 0; }
.v-tool-pv-bar {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px;
  border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px; color: var(--muted);
}
.v-tool-panel {
  flex: 0 0 clamp(300px, 34%, 460px); display: flex; flex-direction: column; gap: 12px;
  padding: 14px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel);
}
.v-tool-panel-h { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.v-tool-panel-h .ico { color: var(--ico-tool, #c07de0); }
.v-tool-prompt { width: 100%; resize: vertical; font: inherit; line-height: 1.4; }
.v-tool-actions { display: flex; align-items: center; gap: 10px; }
.v-tool-status { font-size: 12.5px; min-height: 1em; }
.v-tool-status.err { color: var(--err); }
.v-tool-sec-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  margin-bottom: 6px;
}
.btn-sm { padding: 2px 8px; font-size: 12px; }
.v-tool-asset {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px;
  background: var(--panel2); margin-bottom: 5px; font-size: 13px;
}
.v-tool-asset-kind {
  flex: 0 0 auto; font-size: 10px; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
.v-tool-asset-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-tool-asset-rm { flex: 0 0 auto; }
.v-tool-asset-empty { font-size: 12.5px; margin: 0; }
.v-tool-log-item {
  padding: 8px 10px; border-radius: 8px; background: var(--panel2); margin-bottom: 6px;
}
.v-tool-log-prompt { font-size: 13px; }
.v-tool-log-summary { font-size: 12px; margin-top: 3px; }

@media (max-width: 768px) {
  .v-tool-build { flex-direction: column; }
  .v-tool-preview { flex: 1 1 45%; }
  .v-tool-panel { flex: 1 1 auto; border-left: 0; border-top: 1px solid var(--line); }
}

.v-tool-imgtoggle {
  display: flex; align-items: center; gap: 7px; margin: -4px 0 2px;
  font-size: 13px; color: var(--text); cursor: pointer; user-select: none;
}
.v-tool-imgtoggle input { margin: 0; }
.v-tool-imgtoggle.disabled { color: var(--muted); cursor: not-allowed; }

.v-tool-opts { display: flex; gap: 12px; margin: 2px 0 2px; }
.v-tool-opts label {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted);
}
.v-tool-opts select {
  font: inherit; font-size: 12.5px; padding: 3px 6px; border-radius: 6px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
}

/* Live-Konsole im Bau-Panel */
.v-tool-consolewrap { display: flex; flex-direction: column; min-height: 0; }
.v-tool-console {
  max-height: 40vh; min-height: 60px; overflow-y: auto;
  background: #0b0d12; color: #cdd3de; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: 12px/1.5 ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
.v-cl { margin: 1px 0; }
.v-cl-system  { color: #8a93a6; }
.v-cl-thinking{ color: #7b8397; font-style: italic; }
.v-cl-tool    { color: #6ea8ff; }
.v-cl-text    { color: #cdd3de; }
.v-cl-result  { color: #4ade80; }
.v-cl-error   { color: #ff6b6b; }
