/* =====================================================================
   FASTfinder365 – helles, modernes Design
   Nur das Aussehen; alle Klassennamen bleiben wie gehabt.
   ===================================================================== */
:root {
  --bg: #f4f6fa;
  --bg-soft: #eef1f6;
  --card: #ffffff;
  --ink: #1a2432;
  --ink-soft: #3a4757;
  --muted: #6b7684;
  --line: #e8ecf2;
  --line-strong: #d8dee7;

  --red: #e2001a;
  --red-dark: #b40015;
  --red-soft: #fff1f2;
  --red-tint: #fde7e9;
  --ring: rgba(226, 0, 26, .20);

  --link: #2b63d9;
  --ok-bg: #e7f7ee; --ok-ink: #197a44;
  --err-bg: #fdecec; --err-ink: #b5322a;
  --warn-bg: #fff6e2; --warn-ink: #8a5a00; --warn-line: #f3dca0;
  --mark: #ffe9a6;

  --silz-red: #e2001a;
  --silz-red-dark: #b40015;

  --r-xs: 8px; --r-sm: 10px; --r: 14px; --r-lg: 18px; --pill: 999px;
  --shadow-xs: 0 1px 2px rgba(20, 30, 48, .06);
  --shadow-sm: 0 1px 2px rgba(20, 30, 48, .05), 0 2px 6px rgba(20, 30, 48, .05);
  --shadow-md: 0 6px 20px rgba(20, 30, 48, .09), 0 2px 6px rgba(20, 30, 48, .05);
  --shadow-lg: 0 22px 55px rgba(16, 24, 40, .26);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-weight: 700; }

/* ---------------------------------------------------------------- Kopfleiste */
.topbar {
  display: grid; grid-template-columns: 1fr clamp(280px, 42vw, 560px) 1fr; align-items: center; gap: 22px;
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 28px; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(20, 30, 48, .02), 0 4px 16px rgba(20, 30, 48, .035);
}
.topbar > .brandmark, .topbar > .silz-logo-link { justify-self: start; }
.topbar > nav { justify-self: end; }
/* Logo oben links + Versionszeile mittig darunter */
.brandmark { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.silz-ver { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; line-height: 1; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; flex-shrink: 0; }
.brand-logo { height: 36px; width: auto; display: block; }
.brand-sep { width: 1px; height: 28px; background: var(--line); display: inline-block; }
.brand-name { letter-spacing: -.01em; font-size: 21px; font-weight: 800; line-height: 1; }
.fast { color: var(--silz-red); }
.brand-365 { color: var(--silz-red); }
.brand-ver {
  align-self: center; padding: 2px 8px; border-radius: var(--pill);
  background: var(--bg-soft); color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.topbar-right nav { margin-left: 0; }
.silz-logo-link { display: flex; align-items: center; flex-shrink: 0; opacity: .96; }
.silz-logo-link:hover { opacity: 1; }
.silz-logo { height: 30px; width: auto; display: block; }

.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar nav > a {
  color: var(--ink-soft); font-weight: 600; font-size: 14.5px;
  padding: 8px 12px; border-radius: var(--r-sm); line-height: 1;
}
.topbar nav > a:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }
/* Design B: reine Symbol-Buttons mit Mouseover-Text */
.navicon { position: relative; width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft);
  cursor: pointer; flex: none; }
.navicon:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.navicon.nav-active { color: var(--red); background: var(--red-soft); }
.navicon .nav-badge { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid #fff; box-sizing: border-box; }
.menu > summary.iconsummary { padding: 0; }
.menu > summary.iconsummary::after { display: none; }
/* Mouseover-Text (Tooltip) */
.navtip::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  white-space: nowrap; padding: 5px 9px; border-radius: 7px; opacity: 0; pointer-events: none;
  transition: opacity .12s; z-index: 950; }
.navtip::before { content: ""; position: absolute; top: calc(100% + 3px); left: 50%;
  transform: translateX(-50%); border: 5px solid transparent; border-bottom-color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 950; }
.navtip:hover::after, .navtip:hover::before { opacity: 1; }
.navtip:focus-visible::after, .navtip:focus-visible::before { opacity: 1; }
/* Wenn das Administrator-Menü offen ist, keinen Tooltip zeigen (Panel hat Vorrang). */
.menu[open] > summary.navtip::after, .menu[open] > summary.navtip::before { opacity: 0 !important; }
.who {
  color: var(--ink); font-weight: 600; font-size: 14px;
  padding: 7px 13px; border-radius: var(--pill);
  background: var(--bg-soft); display: inline-flex; align-items: center;
}

/* Zentrales FASTfinder365-Logo über dem Suchfeld */
.brandhero { text-align: center; margin: 6px 0 22px; }
.brandhero-link { display: inline-flex; align-items: center; gap: 12px; }
.brandhero-link:hover { text-decoration: none; }
.brandhero-mark { display: block; flex-shrink: 0; }
.brandhero-name { font-size: 30px; font-weight: 800; letter-spacing: -.015em; color: var(--ink); line-height: 1; }
/* Logo + Versionszeile als zentrierter Block: die Zeile sitzt exakt mittig unter dem Logo. */
.brandhero-stack { display: inline-block; }
.brandhero-link { display: block; }
.brandhero-img { display: block; width: auto; height: auto; max-width: min(440px, 82vw); margin: 0 auto; }
.brandhero-ver { display: block; text-align: center; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
@media (max-width: 560px) { .brandhero-img { max-width: 88vw; } }

/* ---------------------------------------------------------------- Layout */
main { max-width: 960px; margin: 30px auto; padding: 0 22px 70px; }
main.wide { max-width: 1300px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------- Buttons */
.btn, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 650; font-size: 14px; line-height: 1; cursor: pointer;
  border-radius: var(--r-sm); padding: 10px 17px; border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn { background: var(--red); color: #fff; box-shadow: 0 1px 2px rgba(180, 0, 21, .28); }
.btn:hover { background: var(--red-dark); color: #fff; text-decoration: none;
  box-shadow: 0 3px 12px rgba(180, 0, 21, .30); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #e6b8bd; box-shadow: none; cursor: not-allowed; }

.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--bg-soft); border-color: #c6cfdb; text-decoration: none; color: var(--ink); }
.btn-ghost:active { transform: translateY(1px); }

.btn-danger { background: #fff; color: var(--red-dark); border-color: var(--red-tint); }
.btn-danger:hover { background: var(--red-soft); border-color: #f3c9ce; }

.btn-ghost.danger { color: var(--red-dark); border-color: var(--red-tint); }
.btn-ghost.danger:hover { background: var(--red-soft); border-color: #f3c9ce; color: var(--red-dark); }

.small { padding: 6px 11px; font-size: 13px; }

/* ---------------------------------------------------------------- Suche */
.searchbar { display: flex; gap: 10px; margin-bottom: 18px; }
.searchbar input {
  flex: 1; padding: 14px 16px 14px 46px; font-size: 16px; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r); background: #fff;
  box-shadow: var(--shadow-xs);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238a94a2' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat; background-position: 16px 50%;
}
.searchbar input::placeholder { color: #99a2af; }
.searchbar input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--ring); }
.searchbar .btn { padding-left: 22px; padding-right: 22px; }

/* ---------------------------------------------------------------- Upload */
.uploadbar { display: flex; flex-direction: column; gap: 14px; }
.uploadrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.uploadrow input[type=file] { flex: 1; }

.dropzone {
  position: relative; border: 2px dashed #cbd5e3; border-radius: var(--r);
  background: #fbfcfe; padding: 26px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--red); background: #fff8f8; }
.dropzone.drag { border-color: var(--red); background: var(--red-soft); }
.dz-inner { display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.dz-inner strong { font-size: 16.5px; color: var(--ink); }
.dz-inner strong::before {
  content: "⬆"; display: inline-block; margin-right: 8px; color: var(--red);
  font-size: 15px; transform: translateY(-1px);
}
.small-hint { font-size: 12px; }
.dropzone input[type=file] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer;
}
.dz-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#fileList { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress-wrap { margin-top: 4px; }
.progress-bar { height: 9px; background: var(--bg-soft); border-radius: var(--pill); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: var(--pill);
  background: linear-gradient(90deg, #ff4d40, var(--red)); transition: width .2s; }
#progressText { margin-top: 8px; font-size: 13px; font-weight: 600; }

/* ---------------------------------------------------------------- Listenkopf */
.listhead { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 26px 0 12px; }
.results-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 26px 0 12px; font-weight: 700; }
.listhead .results-h { margin: 0; }
.count-badge { display: inline-block; margin-left: 9px; padding: 2px 10px; border-radius: var(--pill);
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: 0; text-transform: none; vertical-align: middle; box-shadow: 0 1px 2px rgba(180,0,21,.25); }
.muted { color: var(--muted); }
.empty { padding: 26px 0; color: var(--muted); }

/* ---------------------------------------------------------------- Dokumentliste */
.doclist, .versionlist { list-style: none; padding: 0; margin: 0; }
.doclist { display: flex; flex-direction: column; gap: 14px; }
.doc, .version { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; }
.doc {
  padding: 16px 18px; margin: 0; border-radius: var(--r);
  transition: box-shadow .16s, border-color .16s, transform .08s;
}
.doc:hover { box-shadow: var(--shadow-md); border-color: #dde3ec; transform: translateY(-2px); }
.doc-main, .version-main { min-width: 0; flex: 1; }
/* Name/Infos oben, Aktions-Buttons darunter (Name wird nie verdeckt). */
.doc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.doc-body .doc-actions { justify-content: flex-start; }

.thumb-link { flex-shrink: 0; display: block; position: relative; }
/* Seitenanzahl-Badge auf der Vorschau (Liste + Kacheln) */
.pages-badge { position: absolute; right: 6px; bottom: 6px; z-index: 2;
  background: rgba(26,36,50,.82); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--pill); white-space: nowrap; }
.thumb {
  width: 152px; height: 198px; object-fit: cover; object-position: top center;
  border: 1px solid var(--line); border-radius: var(--r-xs); background: #fff;
  display: block; box-shadow: var(--shadow-xs); transition: box-shadow .16s, border-color .16s;
}
.thumb-link:hover .thumb { border-color: #c9d3e0; box-shadow: var(--shadow-sm); }

.thumb-zoom {
  position: fixed; z-index: 1000; pointer-events: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 6px; box-shadow: var(--shadow-lg);
}
.thumb-zoom img {
  display: block; width: 440px; max-width: 44vw; height: auto;
  max-height: 84vh; border-radius: var(--r-xs);
}

.doc-name { display: inline-block; font-size: 15.5px; font-weight: 700; color: var(--ink);
  letter-spacing: -.005em; line-height: 1.35;
  overflow-wrap: anywhere; word-break: break-word; }
.doc-name:hover { color: var(--red); text-decoration: none; }
.doc-meta { font-size: 12.5px; margin-top: 7px; color: var(--muted); line-height: 1.55; }
.doc-meta strong { color: var(--ink-soft); font-weight: 600; }
.doc-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; flex-wrap: wrap; }
.doc-actions form { margin: 0; }

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-block; background: var(--bg-soft); color: #46566e;
  border-radius: var(--pill); padding: 2px 10px; font-size: 12px; font-weight: 600; margin-left: 6px;
  vertical-align: middle;
}
.badge.dl { background: var(--ok-bg); color: var(--ok-ink); }
.badge.date { background: #fff3d3; color: #7a5b00; }
.badge.ref { background: #eef1f7; color: #465774; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .3px; margin-left: 0; }
.current-badge { background: var(--ok-bg); color: var(--ok-ink); }
.vno { font-weight: 700; }
.pill { display: inline-block; background: var(--bg-soft); border-radius: var(--r-xs);
  padding: 2px 9px; font-size: 12px; margin: 2px 4px 0 0; color: var(--ink-soft); }

.snippet { margin: 7px 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
mark { background: var(--mark); padding: 0 3px; border-radius: 3px; color: #5a4200; }

/* ---------------------------------------------------------------- Flash */
.flash { padding: 12px 16px 12px 44px; border-radius: var(--r-sm); margin-bottom: 14px;
  font-weight: 500; position: relative; border: 1px solid transparent; }
.flash::before { position: absolute; left: 15px; top: 12px; font-size: 15px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: #c6ecd4; }
.flash.ok::before { content: "✓"; }
.flash.error { background: var(--err-bg); color: var(--err-ink); border-color: #f6cfcc; }
.flash.error::before { content: "⚠"; }
.flash.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.flash.warn::before { content: ""; }
.flash.warn { padding-left: 16px; }
.flash.info { background: #eef4ff; color: #234; border: 1px solid #cddcf5; padding-left: 16px; font-weight: 400; }
.flash.info::before { content: ""; }
.ocr-banner { font-weight: 400; line-height: 1.55; }
.ocr-banner code { background: #f6ecd0; padding: 1px 5px; border-radius: 4px; }

/* ---------------------------------------------------------------- Login */
.login-wrap { display: flex; justify-content: center; margin-top: 7vh; }
.login { width: 360px; display: flex; flex-direction: column; gap: 14px;
  padding: 30px 30px 28px; border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
.login h1 { margin: 0; }
.login label, .formgrid label { display: flex; flex-direction: column; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.login input, .formgrid input {
  padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 15px; font-weight: 400; color: var(--ink); background: #fff;
}
.login input:focus, .formgrid input:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--ring);
}
/* Passwort ein-/ausblenden (Auge) */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 8px; color: var(--muted); cursor: pointer; padding: 0; }
.pw-toggle:hover { color: var(--ink); background: var(--bg-soft); }

/* Archiv-Werkzeugleiste (Mehrfachauswahl + Papierkorb leeren) */
.arch-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.arch-toolbar .arch-spacer { flex: 1; min-width: 12px; }
.arch-check { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }
.btn:disabled, .btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.login .btn { margin-top: 4px; padding-top: 12px; padding-bottom: 12px; }
.login-logo { width: 100%; max-width: 280px; height: auto; margin: 0 auto 6px; display: block; }
.login-title { margin: 0; text-align: center; font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.login-sub { text-align: center; margin: 0 0 8px; }
.login-mark { display: block; margin: 4px auto 8px; }

.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.formgrid .check { flex-direction: row; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- Tabellen */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--bg-soft); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------- Dokumentseite */
.dochead { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.dochead h1 { margin: 4px 0 10px; }
.doctitle { flex: 1 1 340px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.dochead form { flex-shrink: 0; }
.back { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.version.current { border-color: #f3c9ce; }

.doc-layout { display: flex; gap: 26px; align-items: flex-start; }
.doc-col-left { flex: 1 1 460px; min-width: 0; }
.doc-col-right { flex: 1 1 420px; min-width: 0; }

.preview-panel {
  position: sticky; top: 88px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; box-shadow: var(--shadow-sm);
}
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.preview-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--r-xs); background: #fff; }
.preview-imgwrap { border: 1px solid var(--line); border-radius: var(--r-xs); background: #fafbfc;
  max-height: 78vh; overflow: auto; text-align: center; }
.preview-img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.preview-text { border: 1px solid var(--line); border-radius: var(--r-xs); padding: 14px; background: #fff;
  white-space: pre-wrap; word-wrap: break-word; max-height: 78vh; overflow: auto;
  font: 13px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.preview-empty { padding: 40px 16px; text-align: center; line-height: 1.6; color: var(--muted); }
.preview-hint { font-size: 12px; margin-top: 6px; text-align: center; }

.versionlist { display: flex; flex-direction: column; gap: 10px; }
.version { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }

/* Info-Formular (Notizen + Felder) */
.info-card { margin-bottom: 18px; }
.field-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px;
  font-weight: 600; color: var(--muted); margin-bottom: 13px; }
.field-label textarea, .field-label input {
  font-weight: 400; color: var(--ink); font-size: 15px;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-family: inherit;
  background: #fff;
}
.field-label textarea { resize: vertical; }
.field-label textarea:focus, .field-label input:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--ring);
}
.fields-table input { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: var(--r-xs); font-size: 14px; }
.fields-table .order-cell { white-space: nowrap; width: 1%; }
.fields-table td { vertical-align: middle; }

.formgrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 14px; }
.check-inline { flex-direction: row; align-items: center; gap: 8px; }

.textpreview {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; white-space: pre-wrap; word-wrap: break-word; max-height: 70vh; overflow: auto;
  font: 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 34px 0; }
.foot a { color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- Dialog */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(18, 26, 38, .52); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--card); border-radius: var(--r-lg); border: 1px solid var(--line);
  padding: 24px 26px; width: 100%; max-width: 470px; box-shadow: var(--shadow-lg);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.testmail-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Admin-Menü */
.menu { position: relative; }
.menu > summary {
  list-style: none; cursor: pointer; color: var(--ink-soft);
  font-weight: 600; font-size: 14.5px; user-select: none;
  padding: 8px 12px; border-radius: var(--r-sm); line-height: 1;
  display: inline-flex; align-items: center;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; font-size: 10px; margin-left: 6px; opacity: .7; }
.menu > summary:hover { color: var(--ink); background: var(--bg-soft); }
.menu[open] > summary { color: var(--ink); background: var(--bg-soft); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 900;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-md);
  padding: 7px; min-width: 190px; display: flex; flex-direction: column; gap: 2px;
}
.menu-panel a {
  padding: 9px 12px; border-radius: var(--r-xs); color: var(--ink); font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.menu-panel a:hover { background: var(--bg-soft); text-decoration: none; }

/* ---------------------------------------------------------------- Benutzer */
.user-card { display: flex; flex-direction: column; gap: 12px; }
.user-head { display: flex; align-items: center; gap: 10px; }
.user-edit { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.user-edit .field-label { flex: 1; min-width: 160px; margin: 0; }
.user-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  border-top: 1px solid var(--line); padding-top: 12px; }
.user-inline { display: flex; gap: 10px; flex: 1; align-items: flex-end; }

.keylist { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.keyrow { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }

/* ---------------------------------------------------------------- Sortierung */
.sortbar { display: flex; align-items: center; gap: 9px; font-size: 14px; flex-wrap: wrap; }
.sortlink { padding: 6px 13px; border: 1px solid var(--line-strong); border-radius: var(--pill);
  color: var(--muted); font-weight: 600; }
.sortlink:hover { color: var(--ink); text-decoration: none; }
.sortlink.active { background: var(--red); color: #fff; border-color: var(--red); }
.sortselect {
  padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
}
.sortselect:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--ring); }

/* Kopf der Liste: Titel + Bereich links, Steuerung rechts */
.listhead-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.range-info { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.listctrls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Umschalter Liste / Kacheln */
.viewtoggle { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.viewbtn { padding: 6px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 650;
  color: var(--muted); line-height: 1; }
.viewbtn:hover { color: var(--ink); text-decoration: none; }
.viewbtn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-xs); }

/* Kachel-Ansicht */
.tilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.tile { position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-sm);
  transition: box-shadow .16s, border-color .16s, transform .08s; min-width: 0; }
.tile:hover { box-shadow: var(--shadow-md); border-color: #dde3ec; transform: translateY(-2px); }
.tile-link { display: flex; flex-direction: column; color: var(--ink); }
.tile-link:hover { text-decoration: none; }
.tile-thumbwrap { position: relative; }
.tile-thumb { width: 100%; aspect-ratio: 1 / 1.3; object-fit: cover; object-position: top center;
  border: 1px solid var(--line); border-radius: var(--r-xs); background: #fff; display: block; }
.tile-vbadge { position: absolute; top: 32px; right: 6px; background: rgba(26,36,50,.82); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: var(--pill); }
.tile-name { margin-top: 10px; font-size: 13.5px; font-weight: 650; line-height: 1.35; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.tile-meta { margin-top: 7px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile-date { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* Blättern (Pagination) */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
  margin: 28px 0 4px; }
.pagenum, .pagebtn { display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
  font-weight: 650; font-size: 14px; }
.pagenum:hover, .pagebtn:hover { background: var(--bg-soft); border-color: #c6cfdb; text-decoration: none; color: var(--ink); }
.pagenum.current { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 1px 2px rgba(180,0,21,.25); }
.pagebtn.disabled { color: #b7c0cc; background: var(--bg); cursor: default; box-shadow: none; }
.pagebtn.disabled:hover { background: var(--bg); border-color: var(--line-strong); color: #b7c0cc; }
.pagegap { min-width: 22px; text-align: center; color: var(--muted); font-weight: 700; }

/* --- Mehrfachauswahl (Häkchen) --------------------------------------- */
.doc-check { width: 18px; height: 18px; accent-color: var(--red); cursor: pointer; margin: 0; }
.selcheck { display: flex; align-items: flex-start; padding-top: 2px; flex-shrink: 0; }
.selectall { display: inline-flex; align-items: center; gap: 7px; font-size: 14px;
  font-weight: 600; color: var(--ink-soft); cursor: pointer; user-select: none; }
.selectall input { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }

.tile-check { position: absolute; top: 18px; left: 18px; z-index: 3;
  background: rgba(255,255,255,.94); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 4px; display: flex; box-shadow: var(--shadow-xs); cursor: pointer; }
.tile-check input { display: block; width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; margin: 0; }

.doc.selected, .tile.selected { border-color: var(--red); box-shadow: 0 0 0 2px var(--ring); }
.doc.selected { background: var(--red-soft); }

/* Schwebende Auswahl-Leiste unten */
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 900;
  display: flex; align-items: center; gap: 18px;
  background: var(--ink); color: #fff; padding: 12px 16px 12px 20px;
  border-radius: var(--pill); box-shadow: var(--shadow-lg);
}
.selbar[hidden] { display: none; }
.selbar-count { font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.selbar-count strong { font-size: 16px; }
.selbar-actions { display: flex; align-items: center; gap: 8px; }
.selbar-actions .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.selbar-actions .btn-ghost:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.6); color: #fff; }

/* --- Aus-/Einchecken (Sperre) ---------------------------------------- */
.checkout-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.checkout-cell form { margin: 0; }
.co-status { font-size: 11px; font-weight: 700; color: #9a6a00; line-height: 1.25;
  text-align: center; max-width: 150px; }
.co-btn.out { color: var(--ink); border-color: var(--line-strong); }
.co-btn.out:hover { background: var(--bg-soft); }
.co-btn.in { color: var(--ok-ink); border-color: #bfe6cd; background: #fff; }
.co-btn.in:hover { background: var(--ok-bg); border-color: #a9dcbd; color: var(--ok-ink); }
.co-note { font-size: 13px; font-weight: 600; color: #9a6a00; background: var(--warn-bg);
  border: 1px solid var(--warn-line); border-radius: var(--r-sm); padding: 9px 12px; margin: 2px 0 0; }

/* Gesperrte Karten/Kacheln dezent kennzeichnen */
.doc.locked { border-color: #f0d9a6; background: #fffdf6; }
.tile.locked { border-color: #f0d9a6; }
.tile-lock { position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(154,106,0,.92); color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: var(--pill); max-width: calc(100% - 16px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-check:disabled { cursor: not-allowed; }
.dochead-actions { display: flex; align-items: flex-start; gap: 14px; flex-shrink: 0; }

/* ---------------------------------------------------------------- Responsiv */
@media (max-width: 600px) { .formgrid2 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .doc-layout { flex-direction: column; }
  .preview-panel { position: static; width: 100%; }
  .preview-frame { height: 60vh; }
}
@media (max-width: 640px) {
  .doc, .version { flex-direction: column; }
  .formgrid { grid-template-columns: 1fr; }
  .doc-actions { width: 100%; }
  main { padding: 0 16px 60px; }
  .topbar { padding: 10px 16px; }
}
@media (max-width: 560px) { .silz-logo { height: 26px; } .brandhero-name { font-size: 25px; } }

/* Empfänger-Vorschläge (eigenes Autocomplete im Sende-Dialog) */
.recip-wrap { position: relative; }
.recip-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 230px; overflow-y: auto; z-index: 60; padding: 4px;
}
.recip-item {
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-size: 14px; color: var(--ink); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.recip-item::before { content: "✉ "; color: var(--muted); }
.recip-item:hover, .recip-item.active { background: var(--red-soft); color: var(--red-dark); }

/* Aktivitäten-Log */
.btn-sm { padding: 4px 10px; font-size: 13px; }
.act-pw {
  background: var(--red-soft); color: var(--red-dark);
  padding: 3px 9px; border-radius: 6px; font-weight: 600;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border: 1px solid var(--line-strong); cursor: pointer; display: inline-flex;
  align-items: center; gap: 7px; font-size: 13px; line-height: 1.3;
}
.act-pw:hover { border-color: var(--red); background: var(--red-tint); }
.act-pw .act-pw-ic { font-size: 12px; opacity: .7; }
.act-pw.copied { background: var(--ok-bg); color: var(--ok-ink); border-color: #c6ecd4; }

/* Passwort-Zeile im Sende-Dialog (Feld + „Neu"-Knopf) */
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input { flex: 1; }
.pw-row .btn-sm { white-space: nowrap; }

/* Neue-Version-Hochladen-Box auf der Dokumentseite */
.newversion-box { border: 1px dashed var(--line-strong); background: var(--bg-soft);
  border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px; }
.newversion-box .nv-row { display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between; }
.newversion-box .nv-text { display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.newversion-box .nv-hint { font-size: 12px; }
.newversion-box .nv-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.newversion-box input[type=file] { max-width: 100%; font-size: 13px; }

/* Protokoll-Tabelle: feste Spaltenbreiten, damit lange Detail-Texte sauber umbrechen
   und die Zeilen nicht riesig werden (kein Abschneiden der Spalte „Details"). */
.audit-table { table-layout: fixed; }
.audit-table td { vertical-align: top; word-break: break-word; overflow-wrap: anywhere; }
.audit-table td.nowrap { white-space: nowrap; }
.audit-table col.c-ts     { width: 13%; }
.audit-table col.c-user   { width: 12%; }
.audit-table col.c-ip     { width: 11%; }
.audit-table col.c-act    { width: 12%; }
.audit-table col.c-doc    { width: 22%; }
.audit-table col.c-detail { width: 30%; }

/* Deutlich sichtbares Dateityp-Etikett (PDF hervorgehoben – Zusammenführen nur mit PDF). */
.ftype { display: inline-block; vertical-align: middle; font-size: 10.5px; font-weight: 800;
  letter-spacing: .04em; line-height: 1; padding: 3px 6px; border-radius: 5px;
  background: #e7ebf2; color: #4a5a72; border: 1px solid #d3dae6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }
/* PDF: kräftig in Markenrot, damit man es sofort erkennt. */
.ftype.is-pdf { background: var(--red); color: #fff; border-color: var(--red-dark); }
/* Bildtypen leicht abgesetzt (grün), Word/Office (blau) – nur zur schnellen Unterscheidung. */
.ftype-jpg, .ftype-jpeg, .ftype-png, .ftype-tif, .ftype-tiff { background: #e3f3e8; color: #1f6b3a; border-color: #c7e6d1; }
.ftype-docx, .ftype-doc, .ftype-rtf, .ftype-odt { background: #e6eefb; color: #29508f; border-color: #cfe0f7; }
/* In der Listenansicht als Pille direkt vor dem Dateinamen. */
.doc-main .ftype { margin-right: 8px; }
/* In der Kachelansicht als Ecken-Etikett oben rechts. */
.tile-ftype { position: absolute; top: 6px; right: 6px; z-index: 3;
  box-shadow: 0 1px 3px rgba(16,24,40,.25); }

/* Benutzerdefinierte Zusatzfelder in der Listenansicht (z. B. Kundennummer). */
.doc-fields { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.fieldchip { display: inline-block; font-size: 12.5px; color: var(--ink);
  background: #f2f5fa; border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px; }
.fieldchip-label { color: var(--muted); font-weight: 600; }

/* Benutzer-Bearbeiten: Felder-Zeile, Berechtigungen, Speichern untereinander. */
.user-edit { flex-direction: column; align-items: stretch; }
.user-edit-grid { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.user-edit-grid .field-label { flex: 1; min-width: 160px; margin: 0; }
.user-edit > .btn { align-self: flex-start; }
.perm-box { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px 10px; margin: 2px 0; }
.perm-box legend { font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 0 6px; }
.perm-grid { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.perm-item { font-size: 14px; }
.perm-admin { opacity: .75; }

/* ---- Mail-Eingang-Kästchen (Startseite, „Per E-Mail einreichen") ---------- */
.mailbox-c { background: linear-gradient(90deg, #fff, #fbfcfe); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 16px; display: flex; align-items: center;
  gap: 16px; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.mailbox-c .mb-em { width: 42px; height: 42px; border-radius: 11px; background: var(--red-soft);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.mailbox-c .mb-body { flex: 1; min-width: 220px; }
.mailbox-c .mb-h { font-weight: 700; font-size: 15px; color: var(--ink); }
.mailbox-c .mb-h .mb-addr { color: var(--ink); font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; }
.mailbox-c .mb-s { font-size: 13px; color: var(--muted); }
.mailbox-c .mb-copy { border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mailbox-c .mb-copy:hover { background: var(--bg-soft); }
.mailbox-c .mb-state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
  font-weight: 600; padding: 4px 11px; border-radius: var(--pill); }
.mailbox-c .mb-state.ok  { background: var(--ok-bg);  color: var(--ok-ink); }
.mailbox-c .mb-state.warn{ background: var(--warn-bg); color: var(--warn-ink); }
.mailbox-c .mb-state.off { background: var(--bg-soft); color: var(--muted); }
.mailbox-c .mb-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.mailbox-c .mb-state.ok  .mb-dot { background: #22a15a; box-shadow: 0 0 0 3px rgba(34,161,90,.18); }
.mailbox-c .mb-state.warn .mb-dot { background: #c99400; box-shadow: 0 0 0 3px rgba(201,148,0,.18); }
.mailbox-c .mb-state.off .mb-dot { background: #97a0ad; }
.mailbox-c .mb-info { width: 26px; height: 26px; flex: none; border-radius: 50%;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 700;
  font-size: 15px; line-height: 1; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; }
.mailbox-c .mb-info:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.mailbox-c .mb-info.active { background: var(--red); color: #fff; border-color: var(--red); }
/* Info-Panel unter dem Kästchen */
.mb-help { margin-top: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow-sm); }
.mb-help[hidden] { display: none; }
.mb-help-h { font-weight: 700; font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.mb-help-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.mb-help-list li { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.mb-help-list .mb-tag { display: inline-block; background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--pill); padding: 1px 9px; font-weight: 700;
  font-size: 12px; margin-right: 6px; white-space: nowrap; }
.mb-help-list code { background: var(--red-soft); color: var(--red); font-weight: 700;
  padding: 1px 6px; border-radius: 5px; font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; }
.mailbox-solo { margin-bottom: 18px; }

/* Tags (Dokumentseite + Verwaltung) */
.tags-card .tag-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.doc-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--red-soft);
  color: var(--red-dark); border: 1px solid var(--red-tint); border-radius: 999px;
  padding: 4px 10px; font-size: 13px; font-weight: 600; }
.doc-tag-x { border: 0; background: transparent; color: var(--red); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0 0 0 2px; opacity: .7; }
.doc-tag-x:hover { opacity: 1; }
.tag-empty { font-size: 13px; }
.tag-add-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag-add-form #tagAddInput { flex: 1; min-width: 220px; padding: 8px 12px; font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: 9px; }
.tag-add-form #tagAddInput:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--ring); }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--red-soft);
  color: var(--red-dark); border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; }
.tag-rename-input { padding: 7px 11px; font-size: 14px; border: 1px solid var(--line-strong);
  border-radius: 8px; min-width: 200px; }

/* Dateiname umbenennen (Dokumentseite) */
.rename-btn { border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
  border-radius: 8px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer;
  vertical-align: middle; margin-left: 8px; white-space: nowrap; }
.rename-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.rename-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.rename-form[hidden] { display: none; }
.rename-form #renameInput { flex: 1; min-width: 260px; padding: 9px 12px; font-size: 16px;
  border: 1px solid var(--line-strong); border-radius: 9px; font-weight: 600; color: var(--ink); }
.rename-form #renameInput:focus { outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px var(--ring); }
.rename-err { color: var(--err-ink); font-size: 13px; font-weight: 600; }

/* „Merken"-Umschalter auf der Dokumentseite */
.merken-form { margin: 0; }
.btn-merken { display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
  border-radius: var(--pill); padding: 7px 14px; font-size: 14px; font-weight: 600; }
.btn-merken:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.btn-merken .merken-ic { filter: grayscale(1); opacity: .55; font-size: 15px; }
.btn-merken.on { background: var(--red); border-color: var(--red); color: #fff; }
.btn-merken.on:hover { background: var(--red); color: #fff; }
.btn-merken.on .merken-ic { filter: none; opacity: 1; }

/* „Was ist neu?"-Menü */
.whatsnew .wn-dot { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px;
  background: var(--red); border: 2px solid #fff; border-radius: 50%; box-sizing: border-box; }
.wn-panel { min-width: 340px; max-width: 380px; max-height: 70vh; overflow-y: auto; padding: 14px 16px; }
.wn-head { font-weight: 800; font-size: 15px; color: var(--ink); margin-bottom: 10px; }
.wn-rel { padding: 9px 0; border-top: 1px solid var(--line); }
.wn-rel:first-of-type { border-top: 0; padding-top: 0; }
.wn-ver { font-weight: 700; font-size: 13px; color: var(--red); margin-bottom: 5px; }
.wn-ver .wn-date { color: var(--muted); font-weight: 600; }
.wn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wn-list li { font-size: 13px; color: var(--ink-soft); line-height: 1.45; padding-left: 18px; position: relative; }
.wn-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--red); font-weight: 700; }
.wn-foot { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); text-align: right; }

/* „Merken"-Schnellaktion in der Dokumentliste */
.merken-list { display: inline-flex; align-items: center; gap: 6px; }
.merken-list .mk-ic { filter: grayscale(1); opacity: .5; font-size: 13px; }
.merken-list.on { background: var(--red); border-color: var(--red); color: #fff; }
.merken-list.on:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.merken-list.on .mk-ic { filter: none; opacity: 1; }

/* „Meine Ablage"-Kopf */
.ablage-hero { margin: 4px 0 16px; }
.ablage-hero-h { font-size: 24px; font-weight: 800; color: var(--ink); }
.ablage-hero-s { font-size: 14px; color: var(--muted); margin-top: 3px; max-width: 760px; }

/* ---- Suche in der Kopfzeile (Logo · Suche · Menü) ------------------------- */
.topsearch { display: flex; gap: 8px; justify-self: stretch; width: 100%; margin: 0; }
.topsearch input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 9px 14px 9px 38px; font-size: 14.5px; color: var(--ink);
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7684' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.5' y2='16.5' stroke-linecap='round'/></svg>") no-repeat 12px center;
}
.topsearch input::placeholder { color: #99a2af; }
.topsearch input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--ring); }
.topsearch .btn { padding-left: 18px; padding-right: 18px; }
.topsearch-reset { display: inline-flex; align-items: center; justify-content: center;
  width: 38px; padding: 0; font-size: 20px; line-height: 1; color: var(--muted); }
@media (max-width: 760px) {
  .topbar { display: flex; flex-wrap: wrap; }
  .topbar > nav { order: 2; margin-left: auto; }
  .topsearch { order: 3; flex-basis: 100%; width: auto; max-width: none; margin: 8px 0 0; }
}

/* ---- Benutzer-Menü (Namens-Chip mit Avatar, Aktivitäten/Passwort/Abmelden) ---- */
.usermenu > summary {
  gap: 8px; padding: 6px 12px 6px 7px; border-radius: var(--pill);
  background: var(--bg-soft); color: var(--ink); font-weight: 600;
}
.usermenu > summary:hover { background: var(--line); }
.usermenu[open] > summary { background: var(--line); }
.usermenu > summary .av {
  width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex: none;
}

/* ---- Such-Hilfen: Filter-Chips, Zeitraum, „Zuletzt hochgeladen" ----------- */
.filterbar { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; padding:12px 14px; margin-bottom:12px; }
.filterbar.daterow { gap:10px 14px; }
.fgroup { display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.flabel { font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
.chip { display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line-strong); background:#fff;
  color:var(--ink-soft); border-radius:var(--pill); padding:6px 13px; font-size:13.5px; font-weight:600;
  cursor:pointer; white-space:nowrap; line-height:1; }
.chip:hover { background:var(--bg-soft); text-decoration:none; color:var(--ink); }
.chip.active { background:var(--red); border-color:var(--red); color:#fff; }
.chip.active:hover { background:var(--red-dark); color:#fff; }
.chip.toggle.active { background:#eaf6ee; border-color:#bfe6cd; color:var(--ok-ink); }
.fsep { width:1px; height:24px; background:var(--line); }
.daterange { display:flex; align-items:center; gap:8px; background:var(--bg-soft); border:1px solid var(--line);
  border-radius:10px; padding:6px 10px; }
.daterange input { border:1px solid var(--line-strong); border-radius:8px; padding:5px 9px; font-size:13px; background:#fff; }
.filterbar.daterow .dbasis select { border:1px solid var(--line-strong); border-radius:8px; padding:5px 8px; font-size:13px; background:#fff; }
.activefilters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:0 0 12px; font-size:13px; }
.fpill { display:inline-flex; align-items:center; gap:6px; background:var(--red-soft); color:var(--red-dark);
  border:1px solid var(--red-tint); border-radius:var(--pill); padding:4px 10px; font-weight:600; }
.fpill:hover { text-decoration:none; background:var(--red-tint); }
.fpill .x { font-weight:800; }
.clearall { color:var(--link); font-weight:600; }

.recentbar { padding:14px 16px; margin-bottom:14px; }
.recenttitle { margin:0 0 10px; font-size:15px; font-weight:700; display:flex; align-items:center; gap:8px; }
.recentall { margin-left:auto; font-size:13px; font-weight:600; }
.recentrow { display:flex; gap:12px; overflow-x:auto; padding-bottom:4px; }
.reccard { flex:0 0 auto; width:150px; border:1px solid var(--line); border-radius:10px; padding:8px; background:#fff; color:var(--ink); }
.reccard:hover { text-decoration:none; border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
.recthumb { height:82px; border-radius:6px; background:linear-gradient(160deg,#f3f5f9,#e9edf3); position:relative;
  overflow:hidden; display:flex; align-items:center; justify-content:center; }
.recthumb img { max-width:100%; max-height:100%; object-fit:cover; display:block; }
.recthumb .ftype { position:absolute; top:6px; left:6px; }
.recname { font-size:12.5px; font-weight:600; margin-top:7px; line-height:1.25;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.recwhen { font-size:11px; color:var(--muted); margin-top:3px; }
@media (max-width: 560px) { .fsep { display:none; } }

/* ---- Jahres-Gruppierung: grauer Balken je Jahr in Liste & Kacheln --------- */
.yearbar { list-style: none; margin: 0; }
.doclist > .yearbar { margin-top: 6px; }
.doclist > .yearbar:first-child, .tilegrid > .gridbar:first-child { margin-top: 0; }
.tilegrid > .gridbar { grid-column: 1 / -1; margin-top: 6px; }
.yearbar .yr {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 15px;
  font-weight: 800; font-size: 14.5px; color: var(--ink); letter-spacing: .01em;
}
.yearbar .yr::before {
  content: ""; width: 4px; align-self: stretch; border-radius: 3px;
  background: var(--red); margin: -1px 2px -1px -4px;
}

/* ---- Umschalter Normale / Erweiterte Suche ------------------------------- */
/* Kompakter Schalter in der „Dokumente"-Kopfzeile (Position B). */
.advpill { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px 4px 8px;
  background: #fff; user-select: none; }
.advpill:hover { border-color: var(--muted); }
.advpill-txt { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
/* „Nur Tags"-Schalter (Link, der die Tag-Suche umschaltet) */
a.advpill.tagpill { text-decoration: none; }
.tagpill.on { border-color: var(--red); background: var(--red-soft); }
.tagpill.on .advpill-txt { color: var(--red); }
.tagpill.on .slidertrack { background: var(--red); }
.tagpill.on .slidertrack::before { transform: translateX(14px); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slidertrack { position: absolute; inset: 0; background: #cdd4de; border-radius: 999px; transition: background .18s; }
.slidertrack::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(20,30,48,.3); transition: transform .18s; }
.switch input:checked + .slidertrack { background: var(--red); }
.switch input:checked + .slidertrack::before { transform: translateX(18px); }
.switch input:focus-visible + .slidertrack { box-shadow: 0 0 0 3px var(--ring); }
/* Mini-Variante für die Kopfzeile. */
.switch.miniswitch { width: 34px; height: 20px; }
.switch.miniswitch .slidertrack::before { width: 14px; height: 14px; }
.switch.miniswitch input:checked + .slidertrack::before { transform: translateX(14px); }
.advsearch { margin: 0 0 12px; }
.advsearch[hidden] { display: none; }
@media (max-width: 560px) {
  .advpill { padding: 4px 10px 4px 7px; }
  .advpill-txt { font-size: 12.5px; }
}

/* Tarif-Kennzeichnung im Kopf + Demo-Hinweis */
.tariff-pill{display:inline-block;margin-top:3px;padding:1px 8px;border-radius:999px;
  font-size:11px;font-weight:700;letter-spacing:.02em;background:#eef1f6;color:#374151;
  border:1px solid #e0e4ea;line-height:1.5}
.tariff-pill.tariff-demo{background:#fff4d6;color:#8a5a00;border-color:#f0d79a}
.demo-banner{display:block}
.flash.info{background:#eaf3ff;border:1px solid #bcd8f6;color:#1e3a5f}
.user-quota{font-size:13px;color:var(--grey,#6b7280);margin:-2px 0 10px}
.user-quota .full{color:#b4121f;font-weight:700}

/* Tarif-Info im Benutzer-Menü (ersetzt die Plakette im Kopf) */
.menu-info{padding:8px 14px 4px}
.mi-row{display:flex;justify-content:space-between;gap:18px;font-size:13px;color:var(--grey,#6b7280);padding:3px 0}
.mi-row strong{color:var(--dark,#1f2937);font-weight:700}
.mi-row strong.mi-demo{color:#8a5a00}
.mi-row strong.mi-full{color:#b4121f}
.menu-sep{height:1px;background:var(--line,#e5e7eb);margin:6px 0}
