/* Gestaltung angelehnt an mueller-helmert.at (Tokens aus deren styles.css). */

@font-face { font-family: "Geist"; font-weight: 400; font-display: swap; src: url(/fonts/geist-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 500; font-display: swap; src: url(/fonts/geist-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 600; font-display: swap; src: url(/fonts/geist-latin-600-normal.woff2) format("woff2"); }

:root {
  --bg: #FAFAF7;
  --bg-deep: #F2EFE8;
  --ink: #161616;
  --ink-soft: #2E2E2E;
  --muted: #6B6B66;
  --line: #E3DFD4;
  --line-strong: #C9C3B2;
  --accent: #B45A2C;      /* Kupfer */
  --accent-deep: #8C4220;
  --accent-soft: #F5E9E1;
  --steel: #1F3A4D;
  --paper: #FFFFFF;
  --danger: #B3261E;
  --shadow: 0 30px 60px -28px rgba(40, 30, 15, 0.18);
  --radius: 16px;
  --bar-h: 92px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --t-fast: 220ms cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.muted { color: var(--muted); }

.eyebrow {
  margin: 0 0 6px; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}

/* --- Buttons (Pill-Form wie auf der Website) --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border: 1px solid transparent; border-radius: 999px;
  font-weight: 500; font-size: 16px; line-height: 1; cursor: pointer; user-select: none;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover, .btn-primary:active { background: var(--accent); box-shadow: 0 12px 30px -10px rgba(180,90,44,.45); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 12px 30px -12px rgba(180,90,44,.55); }
.btn-accent:active { background: var(--accent-deep); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:active { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: background var(--t-fast);
}
.icon-btn:active { background: var(--bg-deep); }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 500; padding: 8px; cursor: pointer; }

/* --- Formulare --- */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 14px; font-weight: 500; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; height: 54px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper);
  font-size: 17px; /* >=16px verhindert Zoom beim Fokussieren */
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(180,90,44,.12); }
.form-error { color: var(--danger); margin: 0 0 14px; font-size: 15px; }

/* --- Login --- */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 28px 16px;
  background:
    radial-gradient(120% 60% at 100% 0%, var(--accent-soft) 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 22px; padding: 30px 22px 24px; box-shadow: var(--shadow);
}
.login-logo { display: block; width: 180px; height: auto; margin: 0 auto 22px; }
.login .eyebrow { text-align: center; }
.login h1 { text-align: center; margin: 0 0 6px; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.login-server { text-align: center; color: var(--muted); margin: 0 0 26px; font-size: 15px; }
#server-name { font-weight: 500; color: var(--ink-soft); }
.hint { font-size: 13px; color: var(--muted); margin: 20px 0 0; text-align: center; }

/* --- App-Layout --- */
.app { min-height: 100%; padding-bottom: calc(var(--bar-h) + var(--safe-b) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 8px 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(250, 250, 247, 0.88);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand-mark { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; }
.topbar-title { flex: 1; min-width: 0; padding-left: 4px; }
.topbar h1 {
  margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumbs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; font-size: 12.5px; color: var(--muted); white-space: nowrap; letter-spacing: .02em; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button { border: 0; background: none; color: inherit; padding: 2px 0; cursor: pointer; }
.crumbs button:last-child { color: var(--accent); }
.crumbs span { padding: 2px 4px; }
.avatar { background: var(--ink); color: #fff; font-weight: 600; font-size: 15px; width: 38px; height: 38px; margin-left: 2px; }
.avatar:active { background: var(--accent); }

.menu {
  position: fixed; right: 10px; top: 62px; z-index: 30; min-width: 230px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.menu-user { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 0; background: none; cursor: pointer; font-weight: 500; color: var(--danger); }

.content { padding: 14px 14px 0; max-width: 900px; margin: 0 auto; }
.new-folder {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 18px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent;
  color: var(--accent); font-weight: 500; cursor: pointer; margin-bottom: 12px;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.new-folder:active { background: var(--accent-soft); border-color: var(--accent); }

.folders, .files, .photos, .queue-list { list-style: none; margin: 0; padding: 0; }
.folders { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.folders:empty { display: none; }
.folders li + li { border-top: 1px solid var(--line); }
.folders button {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 0 16px;
  border: 0; background: none; text-align: left; cursor: pointer; transition: background var(--t-fast);
}
.folders button:active { background: var(--bg-deep); }
.folders .ico { color: var(--accent); }
.folders .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.folders .chev { color: var(--line-strong); width: 18px; height: 18px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin-top: 14px; }
.photos li { aspect-ratio: 1; background: var(--bg-deep); border-radius: 10px; overflow: hidden; }
.photos button { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

.files { margin-top: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.files:empty { display: none; }
.files li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 15px; color: var(--ink-soft); }
.files li svg { color: var(--muted); }
.files li + li { border-top: 1px solid var(--line); }
.files .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 44px 20px; }
.empty svg { width: 52px; height: 52px; color: var(--line-strong); stroke-width: 1.2; }
.empty p { margin: 6px 0; font-weight: 500; }
.empty .muted { font-weight: 400; }
.loading { display: grid; place-items: center; padding: 40px; }
.spinner { width: 30px; height: 30px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Aktionsleiste unten --- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 10px;
  padding: 14px 14px calc(14px + var(--safe-b));
  background: rgba(250, 250, 247, 0.92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.action { min-height: 62px; font-size: 16px; padding: 0 12px; }

/* --- Upload-Warteschlange --- */
.queue {
  position: fixed; left: 10px; right: 10px; z-index: 25;
  bottom: calc(var(--bar-h) + var(--safe-b) + 8px);
  max-width: 600px; margin: 0 auto; max-height: 45vh; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.queue-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 16px; font-size: 15px; }
.queue-bar { height: 3px; margin: 0 16px 6px; background: var(--line); border-radius: 2px; overflow: hidden; }
.queue-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.queue-list { overflow-y: auto; padding: 0 8px 8px; }
.queue-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; font-size: 14px; }
.queue-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-list .state { color: var(--muted); font-variant-numeric: tabular-nums; }
.queue-list .ok .state { color: var(--steel); }
.queue-list .err .state { color: var(--danger); }
.queue-list .retry { border: 0; background: none; color: var(--accent); font-weight: 500; padding: 4px; cursor: pointer; }

/* --- Bottom-Sheet --- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(22,22,22,.42); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 520px; background: var(--paper);
  border-radius: 22px 22px 0 0; padding: 24px 18px calc(18px + var(--safe-b));
  animation: up .22s cubic-bezier(.2,.7,.2,1);
}
.sheet h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.sheet > .muted { margin: 2px 0 18px; font-size: 14px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* --- Bildvorschau --- */
.viewer { position: fixed; inset: 0; z-index: 50; background: #111; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: calc(100% - 60px); object-fit: contain; }
.viewer p { color: #bbb; font-size: 14px; padding: 12px; margin: 0; text-align: center; word-break: break-all; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--bar-h) + var(--safe-b) + 16px);
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 15px; box-shadow: var(--shadow);
}
.toast.err { background: var(--danger); border-radius: 14px; }

.photos .nopreview button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; color: var(--muted); }
.photos .nopreview span { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-backdrop:not([hidden]) ~ .toast { bottom: auto; top: calc(16px + env(safe-area-inset-top, 0px)); }
