/* Filemanager Mobil (Portal, 20.10.2026) – Stil der Tailscale-Fassung (web/mobil/mobil.css) plus
   Anmeldung, Blatt, Viewer und Toast aus Journal Mobil. Nur Lesen, nur PDFs, verschlüsselt. */
:root {
  --bg: #f3f5f7; --fg: #15202b; --muted: #5d6b7a; --card: #ffffff; --card2: #f6f8fb; --line: #dde3e9; --line2: #cbd3df;
  --akzent: #1F3B54; --akzent-fg: #ffffff; --akzent2: #2E7DA1; --hell: #e7edf3; --rot: #d33b2f; --gruen: #2e9e5b; --mark: #ffe08a;
  --shadow: 0 6px 22px rgba(20,35,60,.09);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f141a; --fg: #e8edf2; --muted: #9aa8b6; --card: #171e26; --card2: #1f2b3a; --line: #2a3542; --line2: #3a4a5c;
          --akzent: #1F3B54; --akzent2: #6FB3D6; --hell: #22303d; --mark: #7a5c00; --shadow: 0 8px 26px rgba(0,0,0,.35); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
       background: var(--bg); color: var(--fg); min-height: 100dvh; overscroll-behavior-y: none; }
body.gesperrt { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; cursor: pointer; touch-action: manipulation; }
h1, h2, h3 { margin: 0; }
.hinweis { color: var(--muted); padding: 14px 12px; margin: 0; }
.hinweis.klein { font-size: 13px; padding: 6px 0 0; }

/* ═══════════ Anmeldung (wie Journal Mobil) ═══════════ */
#anmeldung { min-height: 100dvh; display: grid; place-items: center; padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 24px); }
.karte-login { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 26px 22px; }
.karte-login .logo { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.karte-login .logo img { width: 56px; height: 56px; border-radius: 14px; }
.karte-login h1 { font-size: 23px; color: var(--akzent); }
@media (prefers-color-scheme: dark) { .karte-login h1 { color: var(--fg); } }
.karte-login .unter { color: var(--muted); font-size: 15px; margin-top: 2px; }
.feld { display: block; margin-top: 14px; }
.feld span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.feld input { width: 100%; font-size: 17px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); color: var(--fg); outline: none; min-height: 48px; }
.feld input:focus { border-color: var(--akzent2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent2) 22%, transparent); }
.haken { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 15px; min-height: 44px; }
.haken input { width: 22px; height: 22px; accent-color: var(--akzent2); }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 13px;
         background: var(--akzent2); color: #fff; font-weight: 600; font-size: 17px; width: 100%; margin-top: 10px; }
.knopf:disabled { opacity: .55; }
.status { margin-top: 12px; font-size: 14px; color: var(--muted); min-height: 20px; }
.status.fehler { color: var(--rot); }

/* ═══════════ Kopf ═══════════ */
.kopf { position: sticky; top: 0; z-index: 5; background: var(--akzent); color: var(--akzent-fg);
        padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 14px) 0 calc(env(safe-area-inset-left) + 14px); }
.zeile { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 8px; }
.kopf h1 { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.kopf-rechts { display: flex; align-items: center; gap: 8px; }
.stand { font-size: 13px; opacity: .8; white-space: nowrap; }
.rund { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); color: inherit; font-size: 19px; flex: none; }
.rund:active { background: rgba(255,255,255,.26); }
.suche { position: relative; margin: 8px 0 8px; }
.suche input { width: 100%; height: 44px; font-size: 17px; padding: 0 44px 0 14px; border: 0; border-radius: 12px;
               background: var(--card); color: var(--fg); -webkit-appearance: none; appearance: none; outline: none; }
.suche input::-webkit-search-cancel-button { display: none; }
.suche input::placeholder { color: var(--muted); }
.leeren { position: absolute; right: 0; top: 0; width: 44px; height: 44px; font-size: 26px; line-height: 44px; color: var(--muted); text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.18); font-size: 14px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { font-size: 18px; line-height: 1; padding: 0 2px; }
.chip-neu { background: transparent; border: 1px dashed rgba(255,255,255,.55); color: inherit; font-weight: 600; font-size: 14px; }
.chip-neu:active { background: rgba(255,255,255,.18); }
.umschalter { display: flex; margin: 0 -14px; border-top: 1px solid rgba(255,255,255,.15); }
.umschalter button { flex: 1; min-height: 44px; font-size: 15px; font-weight: 600; opacity: .7; border-bottom: 3px solid transparent; }
.umschalter button.aktiv { opacity: 1; border-bottom-color: #fff; }
.badge { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.25); font-size: 13px; }

/* ═══════════ Inhalt: iPhone eine Spalte, iPad zwei ═══════════ */
.inhalt { display: grid; grid-template-columns: minmax(0, 1fr); padding-bottom: calc(env(safe-area-inset-bottom) + 72px); }
.nav, .treffer { padding: 6px calc(env(safe-area-inset-right) + 8px) 12px calc(env(safe-area-inset-left) + 8px); }
body[data-ansicht="nav"] .treffer { display: none; }
body[data-ansicht="treffer"] .nav { display: none; }
@media (min-width: 760px) {
  .inhalt { grid-template-columns: 320px minmax(0, 1fr); padding-bottom: 16px; }
  .umschalter, .leiste { display: none !important; }
  body[data-ansicht] .nav, body[data-ansicht] .treffer { display: block; }
  .nav { border-right: 1px solid var(--line); min-height: calc(100dvh - 120px); }
  .kopf h1 { font-size: 22px; }
  .suche input { max-width: 640px; }
}
@media (min-width: 1100px) { .inhalt { grid-template-columns: 360px minmax(0, 1fr); } }

/* Schnellzugriff */
.bereich { margin: 8px 0 14px; background: var(--card); border-radius: 14px; overflow: hidden; }
.bereich h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 10px 14px 6px; }
.baum { list-style: none; margin: 0; padding: 0; }
.baum .baum { padding-left: 16px; }
.knoten { display: flex; align-items: stretch; min-height: 48px; border-top: 1px solid var(--line); }
.knoten .name { flex: 1; min-width: 0; text-align: left; padding: 11px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knoten .name.aktiv { background: var(--hell); font-weight: 600; }
.knoten .auf { width: 48px; font-size: 24px; color: var(--muted); transition: transform .15s; }
.knoten .auf.offen { transform: rotate(90deg); }

/* Treffer */
.zuletzt h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 12px 12px 4px; }
.liste { list-style: none; margin: 0 0 10px; padding: 0; background: var(--card); border-radius: 14px; overflow: hidden; }
.liste:empty { display: none; }
.liste li + li { border-top: 1px solid var(--line); }
.treffer-knopf { display: block; width: 100%; text-align: left; padding: 11px 14px; color: inherit; }
.treffer-knopf:active { background: var(--hell); }
.treffer-knopf.fern { opacity: .55; }
.titel { display: block; font-weight: 600; }
.datei { display: block; font-size: 14px; color: var(--muted); word-break: break-all; }
.meta { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.snippet { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.mehr { display: block; width: 100%; min-height: 48px; margin: 4px 0 16px; border-radius: 12px; background: var(--card); color: var(--akzent2); font-weight: 600; }
.leiste { position: fixed; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 6;
          min-height: 50px; border-radius: 14px; background: var(--akzent); color: #fff; font-weight: 600; font-size: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

/* ═══════════ Blatt „Mehr“ ═══════════ */
#blatt-hintergrund { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; opacity: 0; transition: opacity .2s; }
#blatt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--card); border-radius: 22px 22px 0 0;
         max-height: calc(100dvh - env(safe-area-inset-top) - 40px); display: flex; flex-direction: column; box-shadow: 0 -6px 30px rgba(0,0,0,.25);
         transform: translateY(100%); transition: transform .25s ease-out; }
#blatt.offen { transform: translateY(0); } #blatt-hintergrund.offen { opacity: 1; }
.blatt-griff { width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: 8px auto 2px; flex: none; }
.blatt-kopf { display: flex; align-items: center; gap: 10px; padding: 6px 16px 8px; flex: none; }
.blatt-kopf h2 { flex: 1; font-size: 19px; }
.blatt-kopf .rund { background: var(--card2); color: var(--fg); border: 1px solid var(--line); }
.blatt-inhalt { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(env(safe-area-inset-bottom) + 20px); overscroll-behavior: contain; }
.mehr-zeile { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.mehr-zeile span:last-child { color: var(--muted); text-align: right; }
.abschnitt { margin-top: 14px; }
.abschnitt h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.mehr-pfad { font-size: 13.5px; font-family: ui-monospace, Menlo, monospace; color: var(--muted); padding: 3px 0; overflow-wrap: anywhere; }
.mehr-knopf { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; padding: 12px 14px; min-height: 50px; border-radius: 11px;
              background: var(--card2); margin-top: 8px; font-size: 16px; font-weight: 600; }
.mehr-knopf.warn { color: var(--rot); }
.mehr-knopf:disabled { opacity: .55; }
.fuss { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ═══════════ PDF-Viewer (Vollbild, aus Journal Mobil) ═══════════ */
#viewer { position: fixed; inset: 0; z-index: 60; background: #3a3f47; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .25s ease-out; }
#viewer.offen { transform: translateY(0); }
@media (prefers-color-scheme: dark) { #viewer { background: #0b0f15; } }
.viewer-kopf { flex: none; display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; background: var(--card); border-bottom: 1px solid var(--line); color: var(--fg); }
.viewer-kopf .titel { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-kopf .seiten { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); min-height: 44px; padding: 0 8px; border-radius: 10px; white-space: nowrap; }
.viewer-kopf .rund, .viewer-leiste .rund { background: var(--card2); color: var(--fg); border: 1px solid var(--line); width: 40px; height: 40px; font-size: 18px; }
.viewer-leiste { flex: none; display: flex; justify-content: center; gap: 10px; padding: 6px 10px calc(env(safe-area-inset-bottom) + 6px); background: var(--card); border-top: 1px solid var(--line); }
.viewer-leiste .rund { width: 44px; height: 44px; }
.viewer-leiste .prozent { display: grid; place-items: center; min-width: 64px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
#viewer-inhalt { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; position: relative; overscroll-behavior: contain; }
#viewer-seiten { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 20px; min-width: 100%; width: max-content; }
.seite { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); position: relative; flex: none; }
.seite canvas { display: block; }
.seite .nr { position: absolute; inset: 0; display: grid; place-items: center; color: #8a8f98; font-size: 14px; }
#viewer-meldung { position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%); background: rgba(0,0,0,.65); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; max-width: 80%; text-align: center; }

/* ═══════════ Toast ═══════════ */
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 80;
         background: var(--akzent); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 15px; box-shadow: var(--shadow);
         opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; pointer-events: none; text-align: center; }
#toast.zeig { opacity: 1; transform: translateY(0); }
@media (min-width: 700px) { #toast { max-width: 720px; margin: 0 auto; } }

/* ═══════════ Vom Mac holen (Abruf) ═══════════ */
#toast.aktion { pointer-events: auto; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.abruf-titel { font-size: 17px; font-weight: 650; margin-top: 2px; }
.abruf-eintrag { font-size: 14.5px; color: var(--muted); padding: 5px 0; border-bottom: 1px solid var(--line); }
.abruf-text { font-size: 15.5px; line-height: 1.45; margin: 12px 0 4px; }
.treffer-knopf.fern.wartet { opacity: .8; }
