/* =====================================================================
   FR-DMS Design System
   Vanilla CSS, keine Build-Kette. Farben und Abstaende ueber Variablen.
   ===================================================================== */

:root {
  --navy: #0B2545;
  --navy-700: #133b6b;
  --navy-600: #1B4172;
  --navy-100: #e6edf6;
  --teal: #17A2A2;
  --teal-dark: #10807f;
  --teal-600: #128F8F;
  --teal-100: #E2F4F4;
  --teal-200: #BEE6E5;
  --sky: #9FD3DA;
  --ink: #1F2A37;
  --muted: #6B7A90;
  --line: #DFE6EF;
  --line-strong: #C3CFDE;
  --bg: #F4F7FB;
  --bg-soft: #EEF3F9;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFD;

  --ok: #17803D;
  --ok-bg: #E7F6EC;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --err: #B42318;
  --err-bg: #FEE4E2;
  --info: #175CD3;
  --info-bg: #EFF4FF;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, .06), 0 1px 3px rgba(11, 37, 69, .08);
  --shadow: 0 4px 16px rgba(11, 37, 69, .10);
  --shadow-lg: 0 12px 40px rgba(11, 37, 69, .18);

  --sidebar-w: 264px;
  --tree-w: 320px;
  --detail-w: 420px;
  --header-h: 56px;

  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[v-cloak] > * { display: none; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .75rem; }
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: .8rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .82rem; }
.flex { display: flex; gap: .5rem; align-items: center; }
.flex-between { display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- Boot */
.boot-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem;
  background: var(--navy); color: #fff;
}
.boot-logo-img { height: 54px; width: auto; display: block; filter: brightness(0) invert(1); }
.boot-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: var(--teal);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- Layout */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--navy); color: #cfdcec;
  display: flex; flex-direction: column;
  align-self: stretch; height: 100%;
}
.sidebar-brand {
  height: var(--header-h); display: flex; align-items: center; gap: .55rem;
  padding: 0 .85rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-logo-mark { flex: 0 0 auto; border-radius: 10px; }
.sidebar-logo-text b {
  color: #fff; font-size: 16px; display: block; letter-spacing: .3px; line-height: 1.2;
}
.sidebar-logo-text span { color: var(--sky); font-size: 10.5px; line-height: 1.2; }
.sidebar-locale {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-locale-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: #7d94b3; font-weight: 700; margin-right: .15rem;
}
.btn-locale {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.1rem; padding: .18rem .45rem;
  font: inherit; font-size: .72rem; font-weight: 700;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  color: #cfdcec; border-radius: var(--radius-sm); cursor: pointer;
}
.btn-locale:hover { background: rgba(255,255,255,.15); color: #fff; }
.btn-locale.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem 0 1.5rem; }
.nav-section { padding: 1rem 1rem .35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: #7d94b3; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 1rem; color: #cfdcec; cursor: pointer;
  border-left: 3px solid transparent; font-size: .88rem;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(23,162,162,.16); border-left-color: var(--teal); color: #fff; font-weight: 600; }
.nav-item .badge { margin-left: auto; }
.sidebar-footer { padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.09); font-size: .75rem; color: #7d94b3; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--header-h); flex: 0 0 var(--header-h);
  display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar .search-box { flex: 1; max-width: 520px; position: relative; }
.topbar .search-box input { width: 100%; }

.content { flex: 1; padding: 1.25rem; min-width: 0; min-height: 0; overflow: auto; }
.content.flush { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

.view-header { margin-bottom: 1rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.view-header p { margin: 0; }

/* ---------------------------------------------- Dreiteilung Archiv */
.archive-layout {
  display: grid;
  grid-template-columns: var(--tree-w) minmax(0, 1fr) var(--detail-w);
  flex: 1;
  min-height: 0;
}
.archive-layout.no-detail { grid-template-columns: var(--tree-w) minmax(0, 1fr); }
.archive-layout.detail-large { --detail-w: 560px; }
.archive-layout.detail-xlarge { --detail-w: 720px; }
.archive-layout.preview-first:not(.no-detail) {
  grid-template-columns: var(--tree-w) minmax(180px, 0.75fr) minmax(480px, 1.35fr);
}

.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-header {
  display: flex; align-items: center; gap: .5rem; justify-content: space-between;
  padding: .6rem .75rem; border-bottom: 1px solid var(--line); background: var(--surface-alt);
  font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  min-height: 42px;
}
.pane-body { flex: 1; overflow: auto; min-height: 0; }
.pane.detail-pane > .pane-body.pane-body-preview {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pane-footer { border-top: 1px solid var(--line); padding: .5rem .75rem; background: var(--surface-alt); }

/* ---------------------------------------------------------- Archivbaum */
.tree { padding: .35rem 0; user-select: none; }
.tree-node-row {
  display: flex; align-items: center; gap: .3rem;
  padding: .28rem .5rem; cursor: pointer; border-radius: var(--radius-sm);
  margin: 0 .35rem; font-size: .875rem; position: relative;
}
.tree-node-row:hover { background: var(--navy-100); }
.tree-node-row.selected { background: var(--navy); color: #fff; }
.tree-node-row.selected .tree-count { background: rgba(255,255,255,.2); color: #fff; }
.tree-node-row.drop-target { outline: 2px dashed var(--teal); outline-offset: -2px; background: #e6f7f7; }
.tree-node-row.dragging { opacity: .45; }
.tree-toggle {
  width: 16px; height: 16px; flex: 0 0 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .6rem; color: inherit; opacity: .65; transition: transform .12s ease;
}
.tree-toggle.open { transform: rotate(90deg); }
.tree-toggle.leaf { visibility: hidden; }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count {
  font-size: .7rem; padding: 0 .35rem; border-radius: 9px; background: var(--navy-100);
  color: var(--navy-700); font-weight: 600; min-width: 20px; text-align: center;
}
.tree-children { margin-left: .8rem; border-left: 1px solid var(--line); }

/* ------------------------------------------------------ Dokumentliste */
.doc-toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .75rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.breadcrumb { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.breadcrumb button { background: none; border: 0; color: var(--navy-700); cursor: pointer; padding: 0; font-size: .82rem; }
.breadcrumb button:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: .5; }

.doc-list { width: 100%; border-collapse: collapse; font-size: .86rem; }
.doc-list th {
  text-align: left; padding: .5rem .6rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-alt);
  position: sticky; top: 0; z-index: 5; cursor: pointer; white-space: nowrap;
}
.doc-list th.static { cursor: default; }
.doc-list td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.doc-list tbody tr { cursor: pointer; }
.doc-list tbody tr:hover { background: var(--surface-alt); }
.doc-list tbody tr.selected { background: var(--navy-100); }
.doc-list tbody tr.dragging { opacity: .45; }
.doc-name { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.doc-name .file-icon { flex: 0 0 auto; }

.file-icon {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .58rem; font-weight: 700; color: #fff; background: var(--muted); text-transform: uppercase;
}
.file-icon.pdf { background: #C2410C; }
.file-icon.img { background: #7C3AED; }
.file-icon.doc { background: #1D4ED8; }
.file-icon.xls { background: #15803D; }
.file-icon.csv { background: #0F766E; }
.file-icon.zip { background: #B45309; }
.file-icon.mail { background: #0891B2; }
.file-icon.txt { background: #64748B; }
.file-icon.json { background: #CA8A04; }
.file-icon.js { background: #D97706; }
.file-icon.php { background: #777BB4; }
.file-icon.is-ref {
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.file-icon.is-ref::after {
  content: '↗';
  position: absolute;
  right: 1px;
  bottom: -1px;
  font-size: .62rem;
  line-height: 1;
  opacity: .95;
}

.doc-ref-hint {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: var(--teal);
  font-size: .72rem;
  font-weight: 600;
}

.dropzone-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 37, 69, .72); color: #fff; font-size: 1.1rem; font-weight: 600;
  border: 3px dashed var(--teal); border-radius: var(--radius); pointer-events: none;
}

/* --------------------------------------------------- Metadaten/Details */
.detail-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); background: var(--surface-alt); }
.detail-tab {
  padding: .55rem .8rem; font-size: .8rem; cursor: pointer; border: 0; background: none;
  color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600;
}
.detail-tab:hover { color: var(--ink); }
.detail-tab.active { color: var(--navy); border-bottom-color: var(--teal); background: var(--surface); }

.admin-tabs {
  flex-wrap: wrap; row-gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: 1rem; overflow-x: auto;
}
.admin-tabs .detail-tab { white-space: nowrap; }

.status-check-grid,
.status-metric-grid {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.status-check-card,
.status-metric-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem;
}
.status-check-card h3,
.status-metric-card .status-metric-label {
  margin: 0 0 .45rem; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 700;
}
.status-check-card .status-msg { margin: .35rem 0 0; font-size: .84rem; color: var(--ink); }
.status-metric-value { font-size: 1.55rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.status-worker-list { margin-top: .65rem; border-top: 1px solid var(--line); padding-top: .45rem; }
.status-worker-row {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  padding: .3rem 0; font-size: .82rem;
}
.status-worker-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.status-worker-dot.running { background: var(--ok); }
.status-worker-dot.stopped { background: var(--err); }
.status-worker-dot.unknown { background: var(--warn); }
.status-throughput-bars { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.status-bar-row { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.status-bar-track {
  flex: 1; height: 8px; background: var(--navy-100); border-radius: 999px; overflow: hidden;
}
.status-bar-fill { display: block; height: 100%; background: var(--teal); }
.admin-system-section { margin-top: 1.25rem; }
.admin-system-section > h2 {
  margin: 0 0 .75rem; font-size: .95rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}

.login-locale {
  position: absolute; top: 1rem; right: 1rem; z-index: 2;
  display: flex; align-items: center; gap: .35rem;
}
.login-locale-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; margin-right: .15rem;
}
.login-wrap { position: relative; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-600) 55%, var(--teal-600) 140%);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(23,162,162,.35), transparent 65%);
}
.login-brand .logo-box {
  background: rgba(255,255,255,.95); border-radius: 16px; padding: 22px 26px;
  display: inline-block; width: max-content; box-shadow: var(--shadow);
}
.login-brand-logo { height: 54px; width: auto; display: block; }
.login-brand h2 { color: #fff; font-size: 30px; line-height: 1.25; max-width: 460px; margin: 0; }
.login-brand p { color: #cfe3f2; max-width: 440px; font-size: 15px; margin: .75rem 0 0; }
.login-features { display: grid; gap: 14px; }
.login-feature { display: flex; gap: 12px; align-items: center; color: #dbeaf6; font-size: 14px; }
.login-feature .chip {
  background: rgba(255,255,255,.12); border-radius: 10px; padding: 8px; color: var(--sky);
  border: none;
}
.login-card-side { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; }
.login-card-logo { text-align: center; margin-bottom: 28px; }
.login-card-logo img { height: 50px; width: auto; }
.login-card h1 { font-size: 24px; margin: 0 0 6px; color: var(--navy); }
.login-card .sub { color: var(--muted); margin: 0 0 28px; font-size: .9rem; }
.login-sso-btn { margin-top: 10px; }
.login-field-err { margin-bottom: 14px; }
.login-hint {
  margin-top: 18px; font-size: 12.5px; color: var(--muted);
  background: var(--teal-100); border: 1px solid var(--teal-200);
  padding: 10px 12px; border-radius: var(--radius-sm);
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 6px;
  text-transform: none; letter-spacing: normal;
}
.field-err { color: var(--err); font-size: 12px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-left: 36px; }
.spinner {
  width: 18px; height: 18px; border: 2.5px solid var(--teal-200);
  border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner-light { border-color: rgba(255,255,255,.35); border-top-color: #fff; }

.meta-form { padding: .75rem; display: flex; flex-direction: column; gap: .7rem; }
.meta-row { display: grid; grid-template-columns: 1fr; gap: .2rem; }
.meta-row label { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.meta-row .required { color: var(--err); }
.meta-row .help { font-size: .74rem; color: var(--muted); }
.meta-row .field-error { font-size: .74rem; color: var(--err); }

.preview-frame {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: 0;
  background: var(--surface-alt);
}
.preview-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-frame-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-frame-wrap .preview-frame {
  height: 100%;
}
.preview-image { max-width: 100%; display: block; margin: 0 auto; }
.preview-empty { padding: 2rem; text-align: center; color: var(--muted); }

/* -------------------------------------------------------------- Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 1rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: -1rem -1rem 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-alt); border-radius: var(--radius) var(--radius) 0 0; }
.card-header h2, .card-header h3 { margin: 0; }
.card.flush { padding: 0; }
.card.flush .card-header { margin: 0; border-radius: var(--radius) var(--radius) 0 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: var(--teal); }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }

/* -------------------------------------------------------------- Dokument-Feed */
.feed-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: .85rem;
  gap: .85rem;
  min-height: 0;
}
.feed-pane-loading { padding: 1rem 0; }
.feed-timeline {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding-right: .15rem;
}
.feed-card {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: .7rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
  box-shadow: var(--shadow-sm);
}
.feed-card--flow { border-left: 3px solid #6b5ce7; }
.feed-card--workflow { border-left: 3px solid #2f80ed; }
.feed-card--system { border-left: 3px solid var(--muted); }
.feed-card--comment { border-left: 3px solid var(--teal); }
.feed-avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  color: var(--navy);
  background: color-mix(in srgb, var(--teal) 18%, white);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, transparent);
}
.feed-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .35rem;
}
.feed-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}
.feed-card-type {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.feed-message {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: .92rem;
}
.feed-mention {
  display: inline-block;
  padding: .05rem .35rem;
  border-radius: .35rem;
  font-weight: 600;
}
.feed-mention--user {
  color: var(--navy);
  background: color-mix(in srgb, var(--teal) 16%, transparent);
}
.feed-mention--role {
  color: #1f4f8f;
  background: color-mix(in srgb, #2f80ed 14%, transparent);
}
.feed-card-footer { margin-top: .45rem; }
.feed-compose-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .75rem;
  box-shadow: var(--shadow-sm);
}
.feed-compose-head {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .65rem;
}
.feed-compose-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: .75rem;
  font-weight: 700;
  background: var(--surface-alt);
  border: 1px solid var(--line);
}
.feed-compose-editor { position: relative; }
.feed-compose-input {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .65rem .75rem;
  background: var(--surface-alt);
  font: inherit;
}
.feed-compose-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 20%, transparent);
}
.feed-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .55rem;
}
.feed-mention-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + .35rem);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.feed-mention-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .65rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.feed-mention-item:hover,
.feed-mention-item.active {
  background: var(--surface-alt);
}
.feed-mention-item .grow {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}

.checksum-alert {
  padding: .65rem .75rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line));
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.stat-hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }

/* ------------------------------------------------------ Formularelemente */
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; padding: .42rem .55rem; font: inherit; font-size: .86rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(23,162,162,.15); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-alt); color: var(--muted); cursor: not-allowed; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--err); }
textarea { resize: vertical; min-height: 68px; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; cursor: pointer; }
label.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; margin: 0 0 .75rem; }
legend { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 .35rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.form-row { display: flex; flex-direction: column; gap: .2rem; }
.form-row label { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

.id-field { display: flex; flex-direction: column; gap: .2rem; }
.id-field > label { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.id-field-value { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.id-field-value code {
  flex: 0 1 auto; padding: .18rem .4rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-alt); user-select: all;
}

/* ------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .42rem .8rem; font: inherit; font-size: .84rem; font-weight: 600;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-700); border-color: var(--navy-700); }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover:not(:disabled) { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--navy-100); border-color: transparent; }
.btn-sm { padding: .22rem .5rem; font-size: .78rem; }
.btn-icon { padding: .3rem; width: 30px; height: 30px; }
.btn-group { display: inline-flex; gap: .35rem; }

/* -------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .08rem .45rem; font-size: .72rem; font-weight: 600;
  border-radius: 20px; background: var(--navy-100); color: var(--navy-700); white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #EEF2F6; color: var(--muted); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* -------------------------------------------------------------- Tabellen */
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th {
  text-align: left; padding: .5rem .6rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-alt); white-space: nowrap;
}
.table td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-alt); }
.table.clickable tbody tr { cursor: pointer; }

.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--ink); }

/* -------------------------------------------------------------- Dialoge */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(11, 37, 69, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; display: flex; flex-direction: column; max-height: 92vh;
}
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1180px; }
.modal.fullscreen { max-width: min(1680px, 96vw); min-height: 82vh; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 1rem; }
.modal-body { padding: 1rem; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; gap: .5rem; justify-content: flex-end; padding: .75rem 1rem; border-top: 1px solid var(--line); background: var(--surface-alt); border-radius: 0 0 var(--radius) var(--radius); }

/* --------------------------------------------------------------- Hinweise */
.alert { padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .86rem; margin-bottom: .75rem; border: 1px solid transparent; }
.alert-error { background: var(--err-bg); color: var(--err); border-color: #f3b4ae; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #a9dcbb; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d08a; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #b9cdf7; }

.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.toast {
  padding: .6rem .8rem; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  background: var(--ink); color: #fff; font-size: .86rem;
  display: flex; align-items: flex-start; gap: .5rem; animation: toast-in .18s ease;
}
.toast.ok { background: var(--ok); }
.toast.error { background: var(--err); }
.toast.warn { background: var(--warn); }
.toast button { background: none; border: 0; color: inherit; opacity: .75; cursor: pointer; font-size: 1rem; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------- Flow-Builder */
.flow-canvas { display: flex; flex-direction: column; gap: .6rem; }
.flow-block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.flow-block-header {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem;
  border-bottom: 1px solid var(--line); background: var(--surface-alt);
  border-radius: var(--radius) var(--radius) 0 0; font-weight: 600; font-size: .86rem;
}
.flow-block-body { padding: .75rem; }
.flow-step-index {
  width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; flex: 0 0 22px;
}
.flow-arrow { text-align: center; color: var(--line-strong); font-size: 1.1rem; line-height: 1; }
.flow-kind {
  padding: .1rem .45rem; border-radius: 4px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.flow-kind.trigger { background: var(--info-bg); color: var(--info); }
.flow-kind.condition { background: var(--warn-bg); color: var(--warn); }
.flow-kind.action { background: var(--ok-bg); color: var(--ok); }
.flow-kind.user-task { background: #ede9fe; color: #6d28d9; }
.flow-graph-node.kind-user_task { border-color: #c4b5fd; }

.condition-row, .action-row {
  display: grid; gap: .4rem; align-items: start;
  padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-alt); margin-bottom: .5rem;
}
.condition-row { grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) minmax(120px, 1.2fr) auto; }
.condition-row.with-second { grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) auto; }

.step-log { border-left: 2px solid var(--line); margin-left: .55rem; padding-left: .9rem; }
.step-entry { position: relative; padding: .45rem 0; }
.step-entry::before {
  content: ''; position: absolute; left: -1.22rem; top: .8rem;
  width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); border: 2px solid var(--surface);
}
.step-entry.success::before { background: var(--ok); }
.step-entry.failed::before { background: var(--err); }
.step-entry.skipped::before { background: var(--warn); }

/* ------------------------------------------------------ Flow-Graph-Designer */
.flow-graph { display: flex; flex-direction: column; gap: .75rem; }
.flow-graph-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.flow-graph-stage {
  position: relative; overflow: auto; border: 1px dashed var(--line);
  border-radius: var(--radius); background:
    linear-gradient(90deg, rgba(0,0,0,.03) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(0,0,0,.03) 1px, transparent 1px) 0 0 / 24px 24px;
}
.flow-graph-edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.flow-graph-edge { fill: none; stroke: var(--line-strong); stroke-width: 2; marker-end: url(#flow-edge-arrow); }
.flow-graph-edge.branch-true { stroke: #2f9e44; }
.flow-graph-edge.branch-false { stroke: #e03131; }
.flow-graph-arrow { fill: var(--line-strong); stroke: none; }
.flow-graph-arrow.branch-true { fill: #2f9e44; }
.flow-graph-arrow.branch-false { fill: #e03131; }
.flow-graph-edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.flow-graph-edge-hit:hover { stroke: rgba(190, 60, 60, .28); }
.flow-graph-link-preview {
  fill: none; stroke: var(--teal); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none;
}
.flow-graph-node {
  position: absolute; min-height: 78px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm); cursor: grab; user-select: none;
  touch-action: none;
}
.flow-graph-node.kind-conditions { padding-bottom: .15rem; }
.flow-graph-node.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0, 128, 128, .15); }
.flow-graph-node.linking { border-color: var(--info); box-shadow: 0 0 0 2px rgba(58, 122, 190, .18); }
.flow-graph-node.link-target { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 128, 128, .25); }
.flow-graph-node-head {
  display: flex; align-items: center; justify-content: space-between; gap: .35rem;
  padding: .45rem .55rem; border-bottom: 1px solid var(--line); background: var(--surface-alt);
  border-radius: var(--radius) var(--radius) 0 0;
}
.flow-node-title { flex: 1; min-width: 0; font-size: .82rem; font-weight: 600; }
.flow-graph-node-body { padding: .45rem .65rem .55rem; font-size: .82rem; min-height: 1.6rem; }
.flow-node-description { font-size: .78rem; line-height: 1.35; color: var(--text); }
.flow-node-subtitle { font-size: .76rem; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.flow-graph-port {
  position: absolute; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface); cursor: crosshair; padding: 0;
  touch-action: none;
}
/* Unsichtbare Trefferflaeche, damit der Port nicht pixelgenau getroffen werden muss. */
.flow-graph-port::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
.flow-graph-port:hover:not(:disabled),
.flow-graph-node.linking .flow-graph-port.out { border-color: var(--teal); background: var(--teal); }
.flow-graph-port.in { top: -6px; }
.flow-graph-port.out { bottom: -6px; left: 50%; }
.flow-graph-port.out-true { bottom: -6px; left: 28%; margin-left: -6px; }
.flow-graph-port.out-false { bottom: -6px; left: 72%; margin-left: -6px; }
.flow-graph-port.out-true:hover:not(:disabled),
.flow-graph-node.linking .flow-graph-port.out-true { border-color: #2f9e44; background: #2f9e44; }
.flow-graph-port.out-false:hover:not(:disabled),
.flow-graph-node.linking .flow-graph-port.out-false { border-color: #e03131; background: #e03131; }
.flow-port-label {
  position: absolute; bottom: 10px; font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  pointer-events: none; text-transform: uppercase;
}
.flow-port-label-true { left: 22%; color: #2f9e44; }
.flow-port-label-false { left: 66%; color: #e03131; }
.flow-graph-stage.linking .flow-graph-node { cursor: crosshair; }
.flow-graph-inspector { margin-top: .25rem; }

/* ------------------------------------------------------ Flow-Designer Vollbild */
.flow-designer-overlay {
  position: fixed; inset: 0; z-index: 1200; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}
.flow-designer-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.flow-designer-title h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.flow-designer-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.flow-designer-meta input[type="text"] { min-width: 180px; max-width: 280px; }
.flow-designer-body { display: flex; flex: 1; min-height: 0; }
.flow-designer-canvas-wrap {
  flex: 1; min-width: 0; display: flex; flex-direction: column; padding: .75rem; gap: .5rem;
}
.flow-designer-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.flow-designer-stage { flex: 1; min-height: 320px; }
.flow-designer-inspector { max-height: 38vh; overflow: auto; }
.flow-designer-palette {
  width: 320px; border-left: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
.flow-palette-head { padding: .75rem; border-bottom: 1px solid var(--line); }
.flow-palette-head h3 { margin: 0 0 .5rem; font-size: .95rem; }
.flow-palette-section { padding: .5rem .75rem; overflow: auto; }
.flow-palette-section h4 {
  margin: .25rem 0 .5rem; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}
.flow-palette-item {
  display: flex; align-items: center; justify-content: space-between; gap: .35rem;
  padding: .45rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: .35rem; background: var(--surface-alt); cursor: pointer; font-size: .84rem;
}
.flow-palette-item.draggable { cursor: grab; }
.flow-palette-item.disabled { opacity: .45; cursor: not-allowed; }
.flow-palette-item:hover { border-color: var(--teal); }
.flow-palette-item.disabled:hover { border-color: var(--line); }
.flow-graph-port.disabled,
.flow-graph-port:disabled { opacity: .25; cursor: not-allowed; pointer-events: none; }
.flow-module-info {
  position: fixed; inset: 0; z-index: 1300; background: rgba(15, 27, 45, .45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.flow-module-info-card { width: min(680px, 100%); max-height: 85vh; overflow: auto; }
.flow-module-info-body { font-size: .9rem; line-height: 1.55; }
.flow-module-lead { font-size: .95rem; margin: 0 0 .75rem; color: var(--text); }
.flow-module-behavior { margin: 0 0 .5rem; line-height: 1.45; }
.flow-module-summary { margin: 0 0 .35rem; }
.flow-info-section { margin-bottom: 1rem; }
.flow-info-section h4 { margin: 0 0 .35rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--teal); }
.flow-info-hint { margin: 0 0 .5rem; }
.flow-io-list { list-style: none; padding: 0; margin: 0; }
.flow-io-list li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.flow-io-list li strong { display: block; margin-bottom: .15rem; font-weight: 600; }
.flow-io-key { font-size: .78rem; background: var(--surface-2); padding: .05rem .3rem; border-radius: 3px; }
.flow-example-block { margin-bottom: .75rem; }
.flow-example-title { font-size: .82rem; font-weight: 600; margin-bottom: .25rem; }
.flow-example-code {
  margin: 0; padding: .6rem .75rem; background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: .78rem; line-height: 1.45; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}

.flow-variable-picker { margin: .65rem 0; border: 1px solid var(--line); }
.flow-variable-picker-head {
  display: flex; align-items: center; gap: .4rem; padding: .45rem .6rem; cursor: pointer;
  background: var(--surface-alt); border-bottom: 1px solid var(--line);
}
.flow-variable-picker-body { padding: .5rem .6rem; max-height: 220px; overflow: auto; }
.flow-variable-search { width: 100%; margin-bottom: .45rem; }
.flow-variable-item {
  display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start;
  padding: .35rem 0; border-bottom: 1px solid var(--line);
}
.flow-variable-meta { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.flow-variable-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.flow-condition-editor { margin-bottom: .75rem; }
.condition-row.invalid { outline: 1px solid var(--err); border-radius: var(--radius-sm); padding: .2rem; }
.condition-error { grid-column: 1 / -1; }

.recipe-setup-layout {
  display: grid; grid-template-columns: minmax(280px, 1fr) minmax(260px, 340px); gap: 1rem; align-items: start;
}
.recipe-setup-field.active input,
.recipe-setup-field.active select { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0, 128, 128, .12); }
.recipe-setup-archive .card-header { flex-direction: column; align-items: flex-start; gap: .25rem; }
.recipe-setup-tree {
  max-height: 420px; overflow: auto; padding: .5rem .75rem 1rem;
}
.recipe-setup-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }
@media (max-width: 900px) {
  .recipe-setup-layout { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------ Klick-OCR Vorschau */
.preview-click-ocr-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  cursor: text;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .25rem .5rem .75rem;
}
.preview-click-ocr-wrap:focus {
  outline: none;
}
.click-ocr-scroll-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-shrink: 0;
  width: 100%;
  padding: .35rem .5rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.click-ocr-scroll-position {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.click-ocr-page + .click-ocr-page {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}
.click-ocr-page-loading {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.click-ocr-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  flex-shrink: 0;
  width: 100%;
  padding: .25rem .35rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.click-ocr-pager-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
}
.click-ocr-page-input {
  width: 3.25rem;
  text-align: center;
  padding: .2rem .35rem;
}
.click-ocr-pager-hint {
  margin: 0;
  padding: 0 .5rem;
  text-align: center;
  flex-shrink: 0;
}
.click-ocr-page {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.click-ocr-page-label {
  width: 100%;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .15rem 0 .35rem;
}
.click-ocr-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}
.click-ocr-stage .preview-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
  user-select: none;
}
.click-ocr-hit {
  position: absolute;
  box-sizing: border-box;
  background: transparent;
  cursor: text;
  border-radius: 1px;
}
.click-ocr-hit:hover,
.click-ocr-hit.active {
  background: rgba(0, 128, 128, 0.28);
  outline: 1px solid rgba(0, 128, 128, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* Legacy Bereichs-OCR (Verifier) */
.preview-ocr-wrap { position: relative; height: calc(100% - 2.5rem); overflow: auto; }

/* ------------------------------------------------------ Zonen-OCR Editor */
.zone-editor-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; min-height: 320px; }
.zone-editor-canvas { min-height: 280px; padding: .5rem; }
.zone-editor-toolbar { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; padding: 0 .15rem; }
.zone-editor-sheet-wrap { overflow: auto; max-height: 520px; }
.zone-editor-empty {
  min-height: 280px; display: flex; align-items: center; justify-content: center;
  padding: 2rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.zone-editor-sheet {
  position: relative; aspect-ratio: 1 / 1.414; max-height: 480px; margin: 0 auto;
  background: #f8fafc; border: 1px solid var(--line); box-shadow: inset 0 0 0 1px rgba(0,0,0,.03);
  touch-action: none; user-select: none;
}
.zone-editor-sheet.has-image { aspect-ratio: auto; max-height: none; background: #e8edf3; }
.zone-editor-bg-image { display: block; width: 100%; height: auto; pointer-events: none; }
.zone-editor-box {
  position: absolute; border: 2px solid var(--info); background: rgba(0, 120, 200, .14);
  font-size: .65rem; padding: .1rem .2rem; overflow: hidden; cursor: move; box-sizing: border-box;
}
.zone-editor-box.required { border-color: var(--warn); }
.zone-editor-box.active { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0,128,128,.25); z-index: 2; }
.zone-editor-box.invalid { border-color: var(--err); background: rgba(200,0,0,.1); }
.zone-editor-box.valid { border-color: #2e8b57; background: rgba(46,139,87,.12); }
.zone-editor-box.zone-table { border-color: #6d28d9; background: rgba(109,40,217,.1); border-style: dashed; }
.zone-editor-box.loading { opacity: .85; }
.zone-match-highlight {
  position: absolute;
  border: 2px solid #22c55e;
  background: rgba(34, 197, 94, 0.18);
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
}
.zone-editor-label { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-editor-preview { display: block; margin-top: .1rem; font-size: .6rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-resize-handle {
  position: absolute; right: -4px; bottom: -4px; width: 10px; height: 10px;
  background: var(--teal); border: 1px solid #fff; border-radius: 2px; cursor: se-resize;
}
.zone-sample-bar { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; flex-wrap: wrap; }
.zone-live-result { margin-top: .4rem; padding: .35rem .45rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .78rem; }
.zone-live-result.valid { background: rgba(46,139,87,.12); }
.zone-live-result.invalid { background: rgba(200,0,0,.08); }
.zone-positions-table-wrap { margin-top: .4rem; overflow: auto; }
.table-compact td, .table-compact th { padding: .25rem .35rem; font-size: .78rem; }
.json-table-wrap { overflow: auto; margin-top: .25rem; }
.archive-preview-wrap { padding: .75rem; overflow: auto; max-height: calc(100% - 1rem); }
.csv-preview-table { min-width: 100%; }
.archive-text-preview { margin: .75rem; max-height: calc(100% - 1.5rem); overflow: auto; }

.code-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: .75rem;
  border: 1px solid #334155;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1e293b;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}
.code-preview-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .75rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  color: #e2e8f0;
}
.code-preview-title { font-size: .82rem; }
.code-preview-meta { margin-left: auto; color: #94a3b8 !important; }
.code-preview-body {
  flex: 1;
  overflow: auto;
  max-height: calc(100vh - 260px);
  padding: .35rem 0;
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.55;
  color: #e2e8f0;
  background: #1e293b;
}
.code-line { display: flex; min-height: 1.55em; }
.code-line-no {
  flex: 0 0 3.2rem;
  text-align: right;
  padding: 0 .75rem 0 .5rem;
  color: #64748b;
  user-select: none;
  border-right: 1px solid #334155;
}
.code-line-content {
  flex: 1;
  padding: 0 .85rem 0 .75rem;
  white-space: pre;
}
.code-preview-note { margin: 0; padding: .45rem .75rem .65rem; background: #0f172a; }
.code-preview-json .file-icon { background: #CA8A04; }
.code-preview-js .file-icon { background: #D97706; }
.code-preview-php .file-icon { background: #777BB4; }
.hl-keyword { color: #c792ea; }
.hl-string { color: #c3e88d; }
.hl-number { color: #f78c6c; }
.hl-boolean, .hl-null { color: #ff5370; }
.hl-key { color: #82aaff; }
.hl-comment { color: #697098; font-style: italic; }
.hl-var { color: #f07178; }
.hl-php-tag { color: #ff5370; font-weight: 700; }
.zip-entry-name { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; }
.zip-entry-name .file-icon { width: 22px; height: 22px; font-size: .52rem; flex: 0 0 auto; }
.zone-list-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem; margin-bottom: .5rem; cursor: pointer; }
.zone-table-column-hints { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.zone-table-column-hint-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: .35rem; margin-bottom: .35rem; align-items: center; }
.zone-table-column-hint-row select,
.zone-table-column-hint-row input { min-width: 0; }
.zone-list-item.active { border-color: var(--teal); }
.zone-editor-side { max-height: 520px; overflow: auto; }

/* ------------------------------------------------------ Verifier */
.verifier-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
.verifier-layout.has-detail {
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
}
.verifier-queue-wide .verifier-queue-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: .75rem;
  max-height: none;
}
.verifier-queue-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .75rem;
  max-height: calc(100vh - 11rem);
  overflow: auto;
}
.verifier-queue-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: .8rem .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.verifier-queue-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-alt);
}
.verifier-queue-item.selected {
  border-color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
  background: rgba(0, 128, 128, .06);
}
.verifier-queue-title {
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.verifier-queue-meta {
  display: grid;
  gap: .25rem;
  margin-top: .45rem;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.35;
}
.verifier-queue-label {
  display: inline-block;
  min-width: 3.6rem;
  color: var(--line-strong);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.verifier-queue-path {
  margin-top: .45rem;
  font-size: .76rem;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.verifier-queue-time {
  margin-top: .35rem;
}
.verifier-detail-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 1rem; padding: .75rem; align-items: start; }
.verifier-preview { position: relative; overflow: auto; max-height: 70vh; border: 1px solid var(--line); background: var(--surface-alt); }
.verifier-side { max-height: 70vh; overflow: auto; min-width: 0; }
.zone-list-compact { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.zone-missing-fields { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .75rem; }
.verifier-zone-panel { margin-bottom: 1rem; }
.verifier-index-panel { margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.verifier-index-panel > strong { display: block; margin-bottom: .5rem; }

.task-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 1rem;
  min-height: 62vh;
  align-items: stretch;
}
.task-workspace-form {
  overflow: auto;
  max-height: 72vh;
  padding-right: .25rem;
}
.task-workspace-preview {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: 72vh;
}
.document-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.document-preview-header {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: .86rem;
}
.document-preview .preview-frame-wrap,
.document-preview .preview-frame,
.document-preview .preview-image,
.document-preview .preview-empty,
.document-preview pre,
.document-preview .code-preview {
  flex: 1;
  min-height: 0;
}
.document-preview .preview-frame-wrap { display: flex; }
.document-preview .preview-frame { width: 100%; border: 0; min-height: 360px; }
.document-preview .preview-image { width: 100%; height: auto; object-fit: contain; max-height: 68vh; }
.document-preview .preview-empty { display: flex; align-items: center; justify-content: center; padding: 2rem; }

.task-outcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

.flow-port-label-outcome {
  transform: translateX(-50%);
  bottom: -1.35rem;
  top: auto;
  font-size: .62rem;
  max-width: 5.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-graph-node.kind-user_task .flow-graph-port.out {
  transform: translateX(-50%);
}

@media (max-width: 1100px) {
  .task-workspace {
    grid-template-columns: 1fr;
  }
  .task-workspace-preview {
    min-height: 320px;
    max-height: 50vh;
  }
}

.json-table-empty { margin: .35rem 0 0; }
.learned-layouts-panel { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.learned-layout-list { display: flex; flex-direction: column; gap: .5rem; max-height: 220px; overflow: auto; }
.learned-layout-item { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-alt); }
.learned-layout-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

@media (max-width: 1100px) {
  .verifier-layout.has-detail {
    grid-template-columns: 1fr;
  }
  .verifier-queue-list {
    max-height: 240px;
  }
  .verifier-detail-body {
    grid-template-columns: 1fr;
  }
}

pre.code {
  background: #0f1b2d; color: #d7e3f4; padding: .7rem .8rem; border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .78rem; overflow: auto; margin: 0; max-height: 340px;
}

/* ----------------------------------------------------------- Login-Seite (FR-LIMPS Layout) */
.login-locale .btn-locale {
  background: var(--surface); border-color: var(--line-strong); color: var(--navy-700);
}
.login-locale .btn-locale:hover { background: var(--surface-alt); color: var(--ink); }
.login-locale .btn-locale.active { background: var(--teal); border-color: var(--teal); color: #fff; }

/* --------------------------------------------------------------- Sonstiges */
.chip-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem;
  border-radius: 20px; background: var(--surface-alt); border: 1px solid var(--line);
  font-size: .76rem;
}
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; }

.pagination { display: flex; align-items: center; gap: .5rem; justify-content: space-between; padding: .5rem .75rem; }
.pagination .pages { display: flex; gap: .25rem; }

.spinner-inline {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--line-strong); border-top-color: var(--navy); animation: spin .7s linear infinite;
}

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: .25rem; max-height: 400px; overflow-y: auto;
}
.dropdown-item {
  display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left;
  padding: .38rem .5rem; border: 0; background: none; font: inherit; font-size: .84rem;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--ink);
}
.dropdown-item:hover { background: var(--navy-100); }
.dropdown-item.danger { color: var(--err); }
.dropdown-divider { height: 1px; background: var(--line); margin: .25rem 0; }

.quick-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 420px; overflow-y: auto;
}
.quick-group-title { padding: .4rem .6rem .2rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.quick-item { padding: .4rem .6rem; cursor: pointer; font-size: .85rem; display: flex; gap: .5rem; align-items: center; }
.quick-item:hover { background: var(--navy-100); }

.acl-row { display: grid; grid-template-columns: 1fr repeat(4, 62px) 34px; gap: .35rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.acl-head { font-size: .68rem; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-align: center; }

.acl-editor { display: flex; flex-direction: column; gap: 1rem; }
.acl-editor-head {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface) 0%, var(--navy-50) 100%);
}
.acl-editor-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--navy-100); color: var(--navy-700); flex: 0 0 auto;
}
.acl-editor-title { font-weight: 700; font-size: 1rem; }
.acl-effective { text-align: right; min-width: 140px; }
.acl-effective-badges { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; margin-top: .2rem; }
.acl-editor-note {
  padding: .75rem .9rem; border-radius: var(--radius-sm); background: var(--navy-50);
  border: 1px solid var(--line);
}
.acl-section { display: flex; flex-direction: column; gap: .55rem; }
.acl-section-title {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: .35rem;
}
.acl-entry-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .8rem;
  background: var(--surface);
}
.acl-entry-main { display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; }
.acl-entry-actions { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }
.acl-perm-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .65rem; }
.perm-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .55rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: .76rem; cursor: pointer;
}
.perm-chip.active {
  background: rgba(13, 148, 136, .12); border-color: rgba(13, 148, 136, .35); color: var(--teal);
}
.perm-chip.disabled { cursor: default; opacity: .75; }
.acl-empty {
  padding: .85rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); text-align: center;
}
.acl-add-panel {
  padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--navy-50);
}
.acl-subject-pick { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.acl-propagate { margin-top: .25rem; }

.field-editor-wrap { overflow-x: auto; padding-bottom: .25rem; }
.field-editor-table {
  min-width: 980px;
  table-layout: fixed;
}
.field-editor-table th,
.field-editor-table td {
  vertical-align: middle;
}
.field-editor-table th:nth-child(1),
.field-editor-table td:nth-child(1) { width: 16%; }
.field-editor-table th:nth-child(2),
.field-editor-table td:nth-child(2) { width: 18%; }
.field-editor-table th:nth-child(3),
.field-editor-table td:nth-child(3) { width: 14%; }
.field-editor-table .field-flag-head,
.field-editor-table .field-flag-cell { width: 72px; text-align: center; }
.field-editor-table .field-actions-head,
.field-editor-table .field-actions-cell { width: 96px; text-align: right; }
.field-editor-table .field-flag-cell input[type="checkbox"] {
  margin: 0 auto;
  display: block;
}
.field-editor-table input,
.field-editor-table select,
.field-editor-table textarea {
  width: 100%;
}
.field-editor-table thead th {
  font-size: .68rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .03em;
}
.field-editor-main td {
  background: var(--surface-alt);
}
.field-editor-details td {
  padding-top: 0;
  border-bottom: 1px solid var(--line);
}
.field-editor-details .form-grid {
  margin: .25rem 0 .5rem;
}
.field-permissions-box { grid-column: 1 / -1; }
.field-permissions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; max-height: 180px; overflow: auto; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

.meta-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: .75rem 1rem;
}
.meta-form-grid .meta-row {
  margin: 0;
}

.form-layout-editor {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-layout-sidebar {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .75rem;
  background: var(--surface-alt);
}
.form-layout-palette {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 280px;
  overflow: auto;
  margin: .5rem 0;
}
.form-layout-palette-item {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: .45rem .55rem;
  background: var(--surface);
  cursor: grab;
}
.form-layout-palette-item strong { display: block; }
.form-layout-canvas {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .75rem;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: .65rem;
  background: var(--surface-alt);
}
.form-layout-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.form-layout-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: .5rem;
  cursor: grab;
}
.form-layout-item-head {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .35rem;
}
.form-layout-item-head .drag-handle {
  color: var(--muted);
  cursor: grab;
  user-select: none;
}
.form-layout-item-meta {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.form-layout-item-meta select {
  max-width: 120px;
}

/* -------------------------------------------------------------- Responsiv */
@media (max-width: 1280px) {
  :root { --detail-w: 360px; --tree-w: 270px; }
}
@media (max-width: 1024px) {
  .archive-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .archive-layout .pane.detail-pane { display: none; }
  .archive-layout.show-detail { grid-template-columns: minmax(0, 1fr); }
  .archive-layout.show-detail .pane.tree-pane,
  .archive-layout.show-detail .pane.list-pane { display: none; }
  .archive-layout.show-detail .pane.detail-pane { display: flex; }
}
@media (max-width: 960px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* ---------------------------------------------------------------------
   Public document share (FR-DMS branded)
   --------------------------------------------------------------------- */
.share-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.share-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.share-topbar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.share-topbar-brand img { height: 32px; width: auto; }

.share-topbar-brand strong {
  font-size: 1rem;
  color: var(--navy);
  letter-spacing: .02em;
}

.share-badge {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--teal-dark);
  background: var(--teal-100);
  border: 1px solid var(--teal-200);
  padding: .28rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.share-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  min-height: 0;
}

.share-panel-brand {
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-600) 60%, var(--teal-600) 130%);
  color: #fff;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

.share-panel-brand::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(23, 162, 162, .3), transparent 65%);
  pointer-events: none;
}

.share-panel-brand .logo-box {
  background: rgba(255, 255, 255, .95);
  border-radius: 14px;
  padding: 16px 20px;
  display: inline-block;
  width: max-content;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.share-panel-brand .logo-box img {
  height: 42px;
  width: auto;
  display: block;
}

.share-panel-tagline {
  color: #cfe3f2;
  font-size: .9rem;
  line-height: 1.55;
  margin: 0;
  position: relative;
  z-index: 1;
}

.share-doc-card {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  position: relative;
  z-index: 1;
}

.share-doc-card h1 {
  font-size: 1.2rem;
  margin: 0 0 .55rem;
  color: #fff;
  line-height: 1.35;
  word-break: break-word;
}

.share-meta-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .82rem;
  color: #dbeaf6;
}

.share-meta-list li {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}

.share-meta-list .meta-label {
  min-width: 4.5rem;
  color: #9ec5de;
  font-weight: 600;
}

.share-actions {
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.share-actions .btn {
  width: 100%;
  justify-content: center;
}

.share-password-card {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius);
  padding: 1.1rem;
  position: relative;
  z-index: 1;
}

.share-password-card p {
  margin: 0 0 .75rem;
  font-size: .85rem;
  color: #dbeaf6;
}

.share-password-card .input {
  margin-bottom: .65rem;
}

.share-password-card .btn {
  width: 100%;
  justify-content: center;
}

.share-preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 50vh;
  background: var(--surface-alt);
  border-left: 1px solid var(--line);
}

.share-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: .85rem;
  color: var(--muted);
  font-weight: 600;
}

.share-preview-frame {
  flex: 1;
  min-height: 50vh;
  display: flex;
  padding: 1.25rem;
}

.share-preview-inner {
  flex: 1;
  min-height: calc(50vh - 2.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-preview-inner iframe,
.share-preview-inner img {
  width: 100%;
  height: 100%;
  min-height: calc(50vh - 2.5rem);
  border: 0;
  object-fit: contain;
  background: #fff;
}

.share-preview-placeholder {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  max-width: 360px;
}

.share-preview-placeholder .file-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: var(--teal-100);
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-preview-placeholder strong {
  display: block;
  color: var(--navy);
  margin-bottom: .35rem;
  font-size: .95rem;
}

.share-state-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.share-footer {
  padding: .65rem 1.5rem;
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.share-doc-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  position: relative;
  z-index: 1;
  max-height: 220px;
  overflow: auto;
}

.share-doc-list-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.share-doc-list-item:hover,
.share-doc-list-item.active {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .28);
}

.share-doc-list-ext {
  min-width: 2.4rem;
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #cfe3f2;
}

.share-doc-list-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.share-doc-list-body strong {
  font-size: .84rem;
  line-height: 1.3;
  word-break: break-word;
}

.share-doc-list-body .small {
  color: #9ec5de !important;
  word-break: break-word;
}

.share-btn-ghost {
  color: #fff !important;
  border-color: rgba(255, 255, 255, .22) !important;
  background: rgba(255, 255, 255, .08) !important;
}

.share-btn-ghost:hover {
  background: rgba(255, 255, 255, .16) !important;
}

.share-doc-picker {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
  background: var(--surface-alt);
}

.share-doc-picker-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .25rem 0;
}

.share-ext-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: .2rem .45rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .share-body {
    grid-template-columns: 1fr;
  }

  .share-preview-pane {
    border-left: none;
    border-bottom: 1px solid var(--line);
    order: -1;
  }

  .share-panel-brand {
    min-height: auto;
  }
}
@media (max-width: 820px) {
  :root { --sidebar-w: 64px; }
  .sidebar-logo-text, .nav-item span.label, .nav-section, .sidebar-footer, .sidebar-locale-label { display: none; }
  .sidebar-locale { justify-content: center; padding: .45rem .25rem; }
  .nav-item { justify-content: center; padding: .6rem 0; }
  .archive-layout { grid-template-columns: minmax(0, 1fr); }
  .archive-layout .pane.tree-pane { display: none; }
  .archive-layout.show-tree .pane.tree-pane { display: flex; }
  .archive-layout.show-tree .pane.list-pane { display: none; }
}

@media print {
  .sidebar, .topbar, .doc-toolbar, .btn { display: none !important; }
}
