/* =====================================================================
   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: flex; 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);
}
.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: 6px; }
.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; }
.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; }
.brandhero-ver { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------------------------------------------------------------- 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; }
.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); }
.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: 6px; 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; } }
