/* ZenCloud - Dateibrowser
   Tokens aus den beiden Entwuerfen (hell/dunkel). Der Entwurf arbeitet mit
   Inline-Styles und einer festen Breite von 1440px; hier sind daraus Variablen
   und ein Layout geworden, das mitgeht. */

/* Selbst gehostete Schriften. Google Fonts per CDN waere in Deutschland ein
   DSGVO-Problem (LG Muenchen I, 3 O 17493/20) - die IP des Besuchers ginge
   ohne Einwilligung an Google. Alle drei Familien sind OFL-lizenziert.
   Pfade relativ zu app.css im Wurzelverzeichnis. */
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:100 900;font-display:swap;src:url('fonts/InstrumentSans.woff2') format('woff2')}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:100 900;font-display:swap;src:url('fonts/SpaceGrotesk.woff2') format('woff2')}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:100 900;font-display:swap;src:url('fonts/JetBrainsMono.woff2') format('woff2')}

:root {
  --accent:        #E8891F;
  --accent-hover:  #d67c16;
  --accent-soft:   rgba(232, 137, 31, 0.14);
  --accent-ring:   rgba(232, 137, 31, 0.25);
  --danger:        #c0463d;
  --pdf:           #c0463d;
  --sheet:         #2f9e58;
  --doc:           #2f6fd6;
  --image:         #8a5fd6;

  --bg:            #efe9e0;
  --bg-grad:       linear-gradient(160deg, #f8f5f0 0%, #f0e9dd 45%, #eadfcd 100%);
  --panel:         rgba(255, 255, 255, 0.32);
  --panel-strong:  rgba(255, 255, 255, 0.40);
  --panel-border:  rgba(255, 255, 255, 0.50);
  --panel-shadow:  0 26px 60px rgba(60, 48, 28, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --saturate:      200%;

  --text:          #241f1a;
  --text-2:        #3a352d;
  --muted:         #6b665c;
  --muted-2:       #8f8a7f;
  --faint:         #a8a297;
  --faintest:      #c4bfb3;
  --line:          rgba(0, 0, 0, 0.05);
  --line-2:        rgba(0, 0, 0, 0.08);
  --hover:         rgba(0, 0, 0, 0.045);
  --sunken:        rgba(0, 0, 0, 0.035);

  --sans:  'Instrument Sans', system-ui, -apple-system, sans-serif;
  --head:  'Space Grotesk', var(--sans);
  --mono:  'JetBrains Mono', ui-monospace, monospace;
  --r-lg: 24px; --r-md: 16px; --r-sm: 12px; --r-xs: 8px;
}

:root[data-theme='dark'] {
  --accent-soft:   rgba(232, 137, 31, 0.18);
  --bg:            #1a171f;
  --bg-grad:       linear-gradient(160deg, #221f29 0%, #1c1a22 45%, #241f22 100%);
  --panel:         rgba(38, 34, 46, 0.50);
  --panel-strong:  rgba(46, 42, 54, 0.55);
  --panel-border:  rgba(255, 255, 255, 0.07);
  --panel-shadow:  0 26px 60px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --saturate:      180%;

  --text:          #f2f0ee;
  --text-2:        #e4e1e8;
  --muted:         #b6b1bc;
  --muted-2:       #a7a2ad;
  --faint:         #918c99;
  --faintest:      #5c5763;
  --line:          rgba(255, 255, 255, 0.06);
  --line-2:        rgba(255, 255, 255, 0.10);
  --hover:         rgba(255, 255, 255, 0.05);
  --sunken:        rgba(255, 255, 255, 0.04);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 13.5px; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.35); border-radius: 99px; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ── Buehne und Zierkreise ───────────────────────────────────────────────── */
.stage {
  min-height: 100%; background: var(--bg-grad);
  display: flex; gap: 16px; padding: 18px; position: relative; overflow: hidden;
}
.orb { position: absolute; border-radius: 50%; pointer-events: none; }
.orb-1 { top: -260px; right: -160px; width: 760px; height: 760px;
  background: radial-gradient(circle, rgba(232,137,31,0.22) 0%, rgba(232,137,31,0) 62%); }
.orb-2 { bottom: -300px; left: 260px; width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(47,166,160,0.16) 0%, rgba(47,166,160,0) 60%); }
.orb-3 { top: 220px; left: 520px; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(138,95,214,0.12) 0%, rgba(138,95,214,0) 60%); }

.panel {
  background: var(--panel); backdrop-filter: blur(46px) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(46px) saturate(var(--saturate));
  border: 1px solid var(--panel-border); border-radius: var(--r-lg);
  box-shadow: var(--panel-shadow); position: relative; z-index: 2;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar { width: 236px; flex: none; display: flex; flex-direction: column;
  padding: 20px 14px; background: var(--panel-strong); }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px rgba(232,137,31,0.35), inset 0 1px 0 rgba(255,255,255,0.25); }
.brand-name { font-family: var(--head); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }

.nav { margin-top: 22px; display: flex; flex-direction: column; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px;
  border-radius: var(--r-sm); color: var(--muted); font-weight: 500; width: 100%; text-align: left; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item[aria-current='true'] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
:root[data-theme='dark'] .nav-item[aria-current='true'] { color: #ffc98a; }
.nav-item span { flex: 1; }

.spacer { flex: 1; }
.quota { padding: 12px 10px; border-radius: var(--r-md); background: var(--sunken); }
.quota-head { display: flex; justify-content: space-between; font-size: 12px;
  color: var(--muted); margin-bottom: 8px; }
.quota-head b { color: var(--text); font-weight: 600; }
.quota-bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.quota-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .3s; }
.quota-fill.warn { background: var(--danger); }

.me { display: flex; align-items: center; gap: 8px; padding: 12px 6px 2px; }
.me-name { font-size: 12.5px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { border-radius: 99px; display: inline-grid; place-items: center; color: #fff;
  font-weight: 700; flex: none; }
.avatar-sm { width: 20px; height: 20px; font-size: 8.5px; border: 2px solid var(--bg); }
.avatar-md { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 27px; height: 27px; font-size: 10.5px; }
.stack { display: inline-flex; }
.stack .avatar + .avatar { margin-left: -6px; }

/* ── Mitte ───────────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.bar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.crumbs { display: flex; align-items: baseline; gap: 6px; font-size: 14px; min-width: 0;
  overflow: hidden; white-space: nowrap; }
.crumbs button { color: var(--muted-2); }
.crumbs button:hover { color: var(--text); text-decoration: underline; }
.crumbs .sep { color: var(--faintest); }
.crumbs .here { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.tools { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 11px; border: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px;
  font-weight: 500; }
.btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; border-color: transparent;
  box-shadow: 0 4px 14px rgba(232,137,31,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn-danger { color: var(--danger); border-color: transparent; font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: rgba(192,70,61,0.08); color: var(--danger); }
.btn-block { width: 100%; justify-content: center; height: 38px; font-size: 13px; }
.icon-btn { width: 28px; height: 28px; border-radius: var(--r-xs); display: grid; place-items: center;
  color: var(--faint); }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--line-2); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; background: none; outline: none; width: 170px; font-size: 12.5px; }
.search input::placeholder { color: var(--faint); }

.thead { display: flex; align-items: center; gap: 12px; padding: 20px 22px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--faint);
  border-bottom: 1px solid var(--line); }
.col-size { width: 110px; } .col-date { width: 130px; } .col-share { width: 80px; text-align: center; }
.thead .col-size, .thead .col-date { font-family: var(--mono); letter-spacing: 0.03em; }

.rows { flex: 1; overflow-y: auto; padding: 4px 14px 14px; display: flex;
  flex-direction: column; gap: 1px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 8px;
  border-radius: var(--r-sm); cursor: pointer; text-align: left; width: 100%; }
.row:hover { background: var(--sunken); }
.row[aria-selected='true'] { background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-ring); }
.row .name { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .name span.folder { font-weight: 600; }
.row .col-size, .row .col-date { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.row .col-size.empty { color: var(--faint); }
.row .col-share { color: var(--faintest); }
.check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-2);
  flex: none; display: grid; place-items: center; }
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--faint); }
.empty-state b { display: block; color: var(--muted); font-size: 15px; margin-bottom: 6px; }

/* ── Detailpanel ─────────────────────────────────────────────────────────── */
.detail { width: 296px; flex: none; display: flex; flex-direction: column;
  padding: 20px 18px; background: var(--panel-strong); overflow-y: auto; }
.detail-head { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--faint); }
.preview { display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-top: 18px; padding: 22px 0; border-radius: var(--r-md); background: var(--sunken); }
.preview-name { font-size: 13.5px; font-weight: 700; text-align: center; padding: 0 12px;
  overflow-wrap: anywhere; }
.facts { margin-top: 18px; display: flex; flex-direction: column; gap: 11px; }
.fact { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.fact dt { color: var(--muted-2); flex: none; }
.fact dd { margin: 0; font-family: var(--mono); text-align: right; overflow-wrap: anywhere; }
.fact dd.plain { font-family: var(--sans); font-weight: 500; }
.rule { margin: 20px 0 0; height: 1px; background: var(--line-2); }
.access { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.access-row { display: flex; align-items: center; gap: 9px; }
.access-row .who { flex: 1; font-size: 12.5px; font-weight: 500; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.access-row .what { font-size: 11px; color: var(--muted-2); }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.actions .pair { display: flex; gap: 8px; }
.actions .pair .btn { flex: 1; justify-content: center; height: 34px; font-size: 12px; padding: 0 8px; }

/* ── Anmeldung ───────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100%; display: grid; place-items: center; background: var(--bg-grad);
  padding: 24px; position: relative; overflow: hidden; }
.login { width: 100%; max-width: 380px; padding: 32px; background: var(--panel-strong);
  backdrop-filter: blur(46px) saturate(var(--saturate)); border: 1px solid var(--panel-border);
  border-radius: var(--r-lg); box-shadow: var(--panel-shadow); position: relative; z-index: 2; }
.login h1 { font-family: var(--head); font-size: 20px; margin: 18px 0 4px; letter-spacing: -0.02em; }
.login p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; height: 40px; padding: 0 12px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--sunken); outline: none; }
.field input:focus { border-color: var(--accent); }
.alert { margin: 0 0 14px; padding: 10px 12px; border-radius: 11px; font-size: 12.5px;
  background: rgba(192,70,61,0.10); color: var(--danger); }

/* ── Kleinkram ───────────────────────────────────────────────────────────── */
.toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: center; }
.toast { padding: 11px 16px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500;
  background: #241f1a; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.toast.err { background: var(--danger); }
:root[data-theme='dark'] .toast { background: #3a3544; }

dialog { border: 0; padding: 0; background: none; color: inherit; }
dialog::backdrop { background: rgba(20,16,12,0.45); backdrop-filter: blur(3px); }
.sheet { width: min(440px, calc(100vw - 32px)); padding: 22px; background: var(--bg);
  border: 1px solid var(--panel-border); border-radius: var(--r-lg); box-shadow: var(--panel-shadow); }
.sheet h2 { font-family: var(--head); font-size: 16px; margin: 0 0 14px; }
.sheet .row-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.progress { height: 4px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

@media (max-width: 1100px) { .detail { display: none; } }
@media (max-width: 760px) {
  .stage { flex-direction: column; padding: 10px; gap: 10px; }
  .sidebar { width: auto; flex-direction: row; align-items: center; padding: 10px; }
  .nav { flex-direction: row; margin: 0 0 0 12px; overflow-x: auto; }
  .nav-item span, .quota, .me-name { display: none; }
  .col-size, .col-date { display: none; }
}

/* ── Ansichtsumschalter ──────────────────────────────────────────────────── */
.viewswitch { display: flex; gap: 3px; padding: 3px; background: var(--line); border-radius: 10px; }
.vs { width: 28px; height: 28px; border-radius: var(--r-xs); display: grid; place-items: center;
  color: var(--faint); }
.vs:hover { color: var(--text); }
.vs[aria-current='true'] { background: var(--bg); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

/* ── Auswahlleiste ───────────────────────────────────────────────────────── */
.selbar { display: flex; align-items: center; gap: 8px; margin: 14px 22px 0; padding: 8px 12px;
  border-radius: var(--r-sm); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-ring); font-size: 12.5px; font-weight: 600; }
.selbar .btn { height: 30px; font-size: 12px; }
#checkall { cursor: pointer; }

/* ── Kachelansicht ───────────────────────────────────────────────────────── */
.rows.grid { display: grid; gap: 10px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); padding: 14px; }
.rows.grid .row { flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 12px;
  border: 1px solid var(--line-2); text-align: center; }
.rows.grid .row .col-size, .rows.grid .row .col-date { display: none; }
.rows.grid .row .name { flex-direction: column; gap: 10px; }
.rows.grid .row .name span { white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rows.grid .row .check { position: absolute; top: 8px; left: 8px; }
.rows.grid .row { position: relative; }
.rows.grid .col-share { position: absolute; top: 8px; right: 8px; width: auto; }
.rows.grid .tile-icon svg { width: 34px; height: 34px; }
/* In der Kachelansicht ergibt eine Kopfzeile keinen Sinn. */
.thead.hidden { display: none; }

/* ── Nutzerverwaltung ────────────────────────────────────────────────────── */
.urow { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-radius: var(--r-sm); }
.urow:hover { background: var(--sunken); }
.urow .who { flex: 1; min-width: 0; }
.urow .who b { display: block; font-size: 13.5px; font-weight: 600; }
.urow .who small { color: var(--muted-2); font-size: 12px; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; padding: 3px 8px;
  border-radius: 99px; background: var(--line); color: var(--muted); }
.badge.active { background: rgba(47,158,88,0.14); color: #1f7a42; }
.badge.suspended { background: rgba(192,70,61,0.12); color: var(--danger); }
.badge.invited { background: rgba(232,137,31,0.14); color: #a05a0c; }
:root[data-theme='dark'] .badge.active { color: #6ddc9b; }
:root[data-theme='dark'] .badge.invited { color: #ffc98a; }

/* ── Einmal-Token nach dem Anlegen eines Links ───────────────────────────── */
.tokenbox { margin-top: 12px; padding: 12px; border-radius: var(--r-sm); background: var(--sunken);
  border: 1px solid var(--accent-ring); }
.tokenbox code { display: block; font-family: var(--mono); font-size: 11.5px;
  overflow-wrap: anywhere; margin: 8px 0; color: var(--text); }
.tokenbox p { margin: 0; font-size: 12px; color: var(--muted); }
