/* W-Cloud – klare, ruhige Kunden-Optik (dunkelblau/weiß), Handy zuerst */
:root { --navy: #0f1626; --navy2: #1d2a4a; --bg: #f4f5f7; --card: #fff; --line: #e4e5ea; --t: #1d1d21; --t2: #5f6370; --acc: #2f5bd3; --red: #c92a2a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--t); }
button, input { font: inherit; }
[hidden] { display: none !important; }

/* ---------- Taschenrechner ---------- */
.calc { position: fixed; inset: 0; background: #000; color: #fff; display: flex; flex-direction: column; justify-content: flex-end;
  padding: env(safe-area-inset-top) 14px calc(18px + env(safe-area-inset-bottom)); user-select: none; -webkit-user-select: none; }
.calc-display { text-align: right; padding: 0 10px 14px; overflow: hidden; }
.calc-expr { min-height: 24px; color: #8e8e93; font-size: 20px; white-space: nowrap; }
.calc-out { font-size: clamp(48px, 18vw, 86px); font-weight: 300; line-height: 1.05; white-space: nowrap; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.calc-keys button { aspect-ratio: 1; border: 0; border-radius: 50%; background: #333336; color: #fff; font-size: clamp(26px, 8vw, 34px); cursor: pointer; }
.calc-keys button { display: grid; place-items: center; padding: 0; touch-action: none; font-weight: 400; }
.calc-keys button.down { filter: brightness(1.5); }
.calc-keys svg { width: 44%; height: 44%; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; }
html.calc-on, html.calc-on body { background: #000; }  /* sonst grauer Streifen unter/über dem Rechner (Safari färbt nach der Seite) */
.mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
#calc-hint ol { margin: 6px 0 0; padding-left: 20px; }
.calc-keys .fn { background: #a5a5a5; color: #000; }
.calc-keys .op { background: #ff9f0a; }
.calc-keys .zero { grid-column: span 2; aspect-ratio: auto; border-radius: 999px; place-items: center start; padding-left: 12%; }
@media (min-width: 600px) { .calc { max-width: 420px; margin: 0 auto; } }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--navy2), var(--navy)); }
.login-card { width: min(380px, 100%); background: var(--card); border-radius: 18px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.logo { width: 44px; height: 44px; border-radius: 12px; background: var(--navy2); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.login h1 { margin: 14px 0 2px; font-size: 22px; }
.sub { color: var(--t2); margin: 0 0 16px; font-size: 14px; }
.f { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; color: var(--t2); }
.f input { padding: 12px; border: 1px solid #d5d7de; border-radius: 10px; font-size: 16px; color: var(--t); background: #fff; }
.f input:focus { outline: 2px solid var(--acc); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--t2); margin: 4px 0 16px; }
.err { color: var(--red); font-size: 14px; margin: 12px 0 0; }
.small { font-size: 12.5px; color: #8a8f9c; margin: 14px 0 0; }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 10px; border: 1px solid #d5d7de;
  background: #fff; color: var(--t); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--navy2); border-color: var(--navy2); color: #fff; }
.btn.wide { width: 100%; margin-top: 10px; padding: 13px; }
.btn.light { background: #ffffff1f; border-color: transparent; color: #fff; }
.btn.danger { background: #c92a2a; border-color: #c92a2a; color: #fff; }
.icon { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 22px; cursor: pointer; }

/* ---------- Dateien ---------- */
.files { min-height: 100vh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: var(--navy); color: #fff; }
.top .title { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-left: 6px; }
.top .title b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs { font-size: 12px; color: #aab4cc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner { background: #fff1e6; color: #8a4510; padding: 10px 16px; font-size: 14px; }
.toolbar { display: flex; gap: 8px; padding: 12px; max-width: 900px; margin: 0 auto; }
.toolbar input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #d5d7de; border-radius: 10px; background: #fff; }
.list { list-style: none; margin: 0 auto; padding: 0 12px; max-width: 900px; }
.list li { margin-bottom: 8px; }
.item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  text-align: left; cursor: pointer; color: inherit; }
.item:active { background: #eef1f8; }
.item .ico { width: 44px; height: 44px; border-radius: 8px; background: #eef2fd; display: grid; place-items: center; font-size: 22px; flex: none; overflow: hidden; }
.item .ico img { width: 100%; height: 100%; object-fit: cover; }
.item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .txt b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .txt small { color: var(--t2); font-size: 12.5px; }
.chev { color: #b0b4c0; font-size: 22px; }
.muted { color: var(--t2); padding: 12px; }
.empty { text-align: center; color: var(--t2); }
.center { text-align: center; }

/* ---------- Vorschau ---------- */
.viewer { position: fixed; inset: 0; z-index: 20; background: rgba(8,10,18,.96); color: #fff; display: flex; flex-direction: column; }
.vtop { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; flex-wrap: wrap; }
.vtop b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50vw; }
.grow { flex: 1; }
.vbody { flex: 1; display: grid; place-items: center; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); min-height: 0; }
.vbody img, .vbody video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.vbody iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }

/* ---------- Einstellungen ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: min(520px, 100%); background: #fff; border-radius: 18px 18px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-card h2 { margin: 0 0 6px; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 12px 0; }
.row small { display: block; color: var(--t2); font-size: 13px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 1; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #d5d7de; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #1d1d21; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 40; max-width: 90vw; }
.toast.err { background: var(--red); }
.calc-keys .op { font-size: clamp(32px, 10vw, 42px); }
.code-row { display: block; }
.code-edit { display: flex; gap: 8px; margin-top: 10px; }
.code-edit input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #d5d7de; border-radius: 10px; font-size: 16px; letter-spacing: .04em; }
/* Rechner als App: nichts darf scrollen/federn – sonst schluckt iOS Tipps, solange die Seite nachschwingt */
html.calc-on, html.calc-on body { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; touch-action: none; }
.calc, .calc * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.calc { touch-action: none; overscroll-behavior: none; }

/* Runde 21: iOS legt unter die Statusleiste einen Unschärfe-/Verlaufsstreifen über mitscrollende Inhalte.
   Kopfzeile scrollt nicht mehr mit, eine feste, deckende Fläche liegt hinter der Statusleiste (wie im Dashboard). */
.top { position: relative; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top); background: var(--navy); z-index: 50; pointer-events: none; }
html.calc-on body::before { background: #000; }

/* Vorschau: Durchwischen von Bildern/Videos */
.vbody { touch-action: pan-y; overflow: hidden; }
.vbody img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.v-pos { color: #aab4cc; font-size: 13px; white-space: nowrap; }
.from-right { animation: wc-in-r .22s ease-out; }
.from-left { animation: wc-in-l .22s ease-out; }
@keyframes wc-in-r { from { transform: translateX(40px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes wc-in-l { from { transform: translateX(-40px); opacity: .3; } to { transform: none; opacity: 1; } }
.vbody > img, .vbody > video { will-change: transform; }
.vbody > .snap { transition: transform .18s ease-out; }
@keyframes wc-in-r { from { transform: translateX(70%); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes wc-in-l { from { transform: translateX(-70%); opacity: .2; } to { transform: none; opacity: 1; } }
