/* share.henry.re — App-Oberfläche. Tokens: base.css. Aufbau und Regeln: docs/gestaltung.md */

:root {
  --topbar-h: 56px;
  --sidebar-w: 248px;
  --details-w: 340px;
  --row-h: 44px;
  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; }
body { overflow: hidden; }

.skip-link {
  position: fixed; left: var(--sp-2); top: var(--sp-2); z-index: 1000;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  background: var(--accent); color: var(--on-accent); font-weight: var(--fw-strong);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; color: var(--on-accent); }
.noscript { max-width: 36rem; margin: var(--sp-7) auto; padding: 0 var(--sp-4); }

/* ════ Anmeldung ════ */
#login-screen { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg-side); overflow: auto; }
#login-screen.hidden { display: none; }
.login-head { display: flex; align-items: center; height: var(--topbar-h); padding: 0 var(--sp-5); }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--sp-5) var(--sp-4); }
.login-form {
  width: 100%; max-width: 380px;
  padding: var(--sp-6);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg);
}
.login-form h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.login-form > .hint { margin-bottom: var(--sp-5); font-size: var(--fs-base); }
.login-form .check-row { margin: 0 0 var(--sp-5); }
.login-form .check-row .hint { display: block; }
.login-form #login-info { margin-bottom: var(--sp-4); }
.login-foot { padding: var(--sp-4) var(--sp-5) calc(var(--sp-5) + var(--safe-b)); text-align: center; font-size: var(--fs-sm); color: var(--text-2); }

/* ════ App-Rahmen ════ */
#app-shell { display: none; }
#app-shell.visible {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "top top top" "side main details";
  height: 100vh; height: 100dvh;
}

/* Kopfzeile */
.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: calc(var(--sidebar-w) - var(--sp-4)) minmax(0, 1fr) auto;
  align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 20;
}
.topbar-brand { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.topbar-brand img { width: 28px; height: 28px; border-radius: var(--r-sm); flex-shrink: 0; }
.topbar-start { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; }
.search { position: relative; display: flex; align-items: center; width: 100%; max-width: 640px; }
.search > .bi-search { position: absolute; left: var(--sp-3); color: var(--text-2); pointer-events: none; font-size: 16px; }
.search input {
  height: 40px; padding-left: 40px; padding-right: 72px;
  border-color: transparent; border-radius: var(--r-md);
  background: var(--bg-hover);
}
.search input:hover { border-color: var(--line-strong); }
.search input:focus-visible { background: var(--bg-input); }
.search input::-webkit-search-cancel-button { display: none; }
.search .search-kbd { position: absolute; right: var(--sp-3); pointer-events: none; }
.search #btn-search-clear { position: absolute; right: var(--sp-1); }
.search.has-value .search-kbd { display: none; }
.topbar-end { display: flex; align-items: center; gap: var(--sp-1); }
.account-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-2) 0 var(--sp-1);
  border: 0; border-radius: var(--r-full); background: transparent; color: var(--text);
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--bg-hover); }
.account-btn .bi-chevron-down { font-size: 12px; color: var(--text-2); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-weight: var(--fw-strong); font-size: var(--fs-base);
}
.avatar-lg { width: 40px; height: 40px; font-size: var(--fs-md); }

/* Seitenleiste */
.sidebar {
  grid-area: side;
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--bg-side);
}
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-3) var(--sp-2); }
.sidebar-foot { padding: var(--sp-3) var(--sp-2) var(--sp-3); border-top: 1px solid var(--line); }
.nav { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 36px; padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text); text-decoration: none;
  font-size: var(--fs-base);
}
.nav-item > .bi { font-size: 16px; width: 18px; text-align: center; color: var(--text-2); flex-shrink: 0; }
.nav-item > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-selected); font-weight: var(--fw-strong); color: var(--text); }
.nav-item.active > .bi { color: var(--accent); }
.nav-count { font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.nav-heading {
  display: flex; align-items: center; justify-content: space-between;
  margin: var(--sp-4) 0 var(--sp-1); padding: 0 var(--sp-3);
  font-size: var(--fs-sm); font-weight: var(--fw-strong); color: var(--text-2);
}

/* Ordnerbaum (Offenlegungsmuster: Link + Auf-/Zuklappen) */
.tree, .tree ul { list-style: none; }
.tree-row {
  display: flex; align-items: center;
  min-height: 32px; border-radius: var(--r-sm);
  padding-left: calc(var(--depth, 0) * 14px);
}
.tree-row:hover { background: var(--bg-hover); }
.tree-row.active { background: var(--bg-selected); }
.tree-row.active .tree-link { font-weight: var(--fw-strong); }
.tree-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 28px; flex-shrink: 0;
  border: 0; background: transparent; color: var(--text-2); border-radius: 4px; font-size: 12px;
}
.tree-toggle:hover { color: var(--text); }
.tree-toggle[aria-expanded="true"] .bi { transform: rotate(90deg); }
.tree-toggle .bi { transition: transform var(--t-fast); }
.tree-spacer { width: 24px; flex-shrink: 0; }
.tree-link {
  display: flex; align-items: center; gap: var(--sp-2);
  flex: 1; min-width: 0; min-height: 28px; padding-right: var(--sp-2);
  color: var(--text); text-decoration: none; font-size: var(--fs-base);
}
.tree-link:hover { color: var(--text); }
.tree-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-link > .bi { color: var(--type-folder); font-size: 15px; flex-shrink: 0; }
.tree-empty { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }

/* Speicheranzeige */
.storage { padding: var(--sp-1) var(--sp-3) var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.storage strong { color: var(--text); font-weight: var(--fw-strong); }
.storage .bar { margin: var(--sp-2) 0 var(--sp-1); }
.storage .bar.warn > span { background: var(--warning); }
.storage .bar.full > span { background: var(--danger); }
.nav-item-sm { min-height: 32px; font-size: var(--fs-sm); }

/* Hauptbereich und Ansichten */
.main { grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.main:focus { outline: none; }
.view { display: none; flex-direction: column; flex: 1; min-height: 0; }
.view.active { display: flex; }
.view-top { flex-shrink: 0; padding: var(--sp-4) var(--sp-5) 0; }
.view-head { display: flex; align-items: center; gap: var(--sp-3); min-height: 40px; }
.view-head h1 { font-size: var(--fs-lg); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-sub { margin-top: var(--sp-1); color: var(--text-2); max-width: 70ch; }
.view-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex-shrink: 0; }
.view-body { flex: 1; min-height: 0; overflow: auto; padding: 0 var(--sp-5) var(--sp-7); }
.page { max-width: 820px; }

/* Brotkrumen: Vorfahren als Links, aktueller Ordner als Überschrift */
.crumbs { display: flex; align-items: center; min-width: 0; flex: 1; }
.crumbs ol { display: flex; align-items: center; min-width: 0; list-style: none; gap: 2px; }
.crumbs li { display: flex; align-items: center; min-width: 0; }
.crumbs li + li::before { content: '›'; padding: 0 var(--sp-1); color: var(--text-2); font-size: var(--fs-lg); line-height: 1; }
.crumb {
  max-width: 220px; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm);
  border: 0; background: transparent;
  color: var(--text-2); font-size: var(--fs-lg); line-height: var(--lh-tight); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb:hover { background: var(--bg-hover); color: var(--text); }
.crumbs h1 { padding: var(--sp-1) var(--sp-2); }
.crumbs li:first-child .crumb, .crumbs li:first-child h1 { margin-left: calc(-1 * var(--sp-2)); }
.crumb-menu { margin-left: var(--sp-1); }

/* Werkzeugleiste und Auswahlleiste teilen sich die Zeile (kein Springen) */
.toolbar { container-type: inline-size; position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; margin-top: var(--sp-2); border-bottom: 1px solid var(--line); }
.toolbar-info { flex: 1; min-width: 0; color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-end { display: flex; align-items: center; gap: var(--sp-1); }
.toolbar.has-selection > :not(.selbar) { visibility: hidden; }
.toolbar.has-selection #btn-details { visibility: visible; }
#view-files .toolbar .selbar { right: 44px; }
.segmented { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--bg-hover); }
.segmented .icon-btn { width: 30px; height: 28px; font-size: 15px; }
.segmented .icon-btn[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.selbar {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-2); margin: var(--sp-1) 0;
  border-radius: var(--r-md); background: var(--bg-selected);
}
.selbar-count { font-weight: var(--fw-strong); white-space: nowrap; margin-right: var(--sp-2); }
.selbar-actions { display: flex; align-items: center; gap: var(--sp-1); flex: 1; min-width: 0; overflow: hidden; }
.selbar .btn { color: var(--text); }
.selbar .btn:hover { background: var(--bg-hover); }
.selbar .btn-danger-quiet { color: var(--danger); }

/* ════ Dateiliste ════ */
.ftable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ftable th {
  position: sticky; top: 0; z-index: 1;
  height: 40px; padding: 0 var(--sp-3);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-strong); text-align: left; white-space: nowrap;
}
.ftable td { height: var(--row-h); padding: 0 var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.th-sort {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  margin-left: calc(-1 * var(--sp-2)); padding: var(--sp-1) var(--sp-2);
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: inherit; font-weight: inherit;
}
.th-sort:hover { background: var(--bg-hover); color: var(--text); }
.th-sort .bi { font-size: 12px; }
.th-sort.sorted { color: var(--text); }
.c-check { width: 44px; padding-right: 0 !important; }
.c-check input { display: block; }
.c-date { width: 150px; color: var(--text-2); white-space: nowrap; }
.c-size { width: 96px; color: var(--text-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ftable th.c-size { text-align: right; }
.ftable th.c-size .th-sort { margin-left: 0; margin-right: calc(-1 * var(--sp-2)); }
.c-share { width: 150px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-where { width: 22%; color: var(--text-2); }
.c-act { width: 128px; text-align: right; }
.ftable td.c-date, .ftable td.c-size { font-size: var(--fs-sm); }
.ftable td.c-share, .ftable td.c-where { font-size: var(--fs-sm); }

.row { cursor: default; }
@media (hover: hover) { .row:hover > td { background: var(--bg-hover); } }
.row.selected > td { background: var(--bg-selected); }
.row.focus-row > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.row-check { opacity: 0; }
.row:hover .row-check, .row.selected .row-check, .row-check:focus-visible,
.has-selection .row-check, #select-all, .touch .row-check { opacity: 1; }
.is-loading-row td { color: var(--text-2); }

.name-cell { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.ficon {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: var(--r-sm); overflow: hidden;
  font-size: 20px;
}
.ficon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficon .play { position: absolute; font-size: 14px; color: #fff; text-shadow: 0 0 4px rgba(0, 0, 0, 0.8); }
.name-text { display: flex; flex-direction: column; min-width: 0; }
.name-line { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.name-link {
  min-width: 0; padding: 0; border: 0; background: transparent;
  color: var(--text); text-align: left; font-size: var(--fs-base);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (hover: hover) { .name-link:hover { text-decoration: underline; text-underline-offset: 2px; } }
.name-link.locked { color: var(--text-2); font-style: italic; }
.name-sub { display: none; color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.name-where { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1); flex-shrink: 0;
  padding: 0 var(--sp-2); min-height: 20px; border-radius: var(--r-full);
  background: var(--bg-active); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: var(--fw-strong); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.share-cell { display: inline-flex; align-items: center; gap: var(--sp-1); }
.share-cell .bi { color: var(--accent); font-size: 15px; }
.where-link {
  max-width: 100%; padding: 0; border: 0; background: transparent;
  color: var(--text-2); font-size: var(--fs-sm); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.where-link:hover { color: var(--text); text-decoration: underline; }

.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; }
.row-actions .quick { opacity: 0; }
.row:hover .quick, .row.selected .quick, .row .quick:focus-visible, .row:focus-within .quick { opacity: 1; }
.group-row td { height: 40px; padding-top: var(--sp-4); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-strong); background: var(--bg) !important; }

/* Kacheln */
.tiles-section + .tiles-section { margin-top: var(--sp-5); }
.tiles-heading { margin: var(--sp-4) 0 var(--sp-3); font-size: var(--fs-sm); font-weight: var(--fw-strong); color: var(--text-2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--sp-3); }
.tiles-folders { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); overflow: hidden;
}
@media (hover: hover) { .tile:hover { background: var(--bg-hover); } }
.tile.selected { border-color: var(--accent); background: var(--bg-selected); box-shadow: inset 0 0 0 1px var(--accent); }
.tile-thumb {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; background: var(--bg-hover); overflow: hidden; font-size: 40px;
}
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-thumb .play { position: absolute; font-size: 32px; color: #fff; text-shadow: 0 0 8px rgba(0, 0, 0, 0.7); }
.tile-body { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3) var(--sp-3); min-width: 0; }
.tile-meta { color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tile .row-check { position: absolute; top: var(--sp-2); left: var(--sp-2); width: 18px; height: 18px; z-index: 1; }
.tile .tile-menu { position: absolute; top: var(--sp-1); right: var(--sp-1); z-index: 1; background: var(--bg-raised); opacity: 0; box-shadow: var(--shadow-1); }
.tile:hover .row-check, .tile.selected .row-check, .tile:hover .tile-menu, .tile:focus-within .tile-menu, .tile:focus-within .row-check { opacity: 1; }
.tile-folder { flex-direction: row; align-items: center; gap: var(--sp-3); min-height: 52px; padding: 0 var(--sp-2) 0 var(--sp-3); }
.tile-folder > .row-check { position: absolute; left: 14px; top: 50%; margin-top: -9px; }
.tile-folder:hover > .bi, .tile-folder.selected > .bi, .tile-folder:focus-within > .bi, .has-selection .tile-folder > .bi { visibility: hidden; }
.tile-folder > .bi { font-size: 20px; flex-shrink: 0; }
.tile-folder .name-link { flex: 1; }
.tile-folder .tile-menu { position: static; opacity: 1; box-shadow: none; background: transparent; }

/* Fotos: Raster nach Monat */
.photo-group + .photo-group { margin-top: var(--sp-5); }
.photo-group h2 { position: sticky; top: 0; z-index: 1; padding: var(--sp-3) 0 var(--sp-2); background: var(--bg); font-size: var(--fs-md); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-1); }
.photo { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-hover); }
.photo-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; }
.photo .tile-thumb { aspect-ratio: auto; height: 100%; }
.photo .row-check { position: absolute; top: var(--sp-2); left: var(--sp-2); width: 24px; height: 24px; }
.photo:hover .row-check, .photo.selected .row-check { opacity: 1; }
.photo.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.photo.selected .photo-open { opacity: 0.85; }

/* Zustände (leer, Filter ohne Treffer, Fehler, Laden) */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: var(--sp-2); padding: var(--sp-7) var(--sp-4); min-height: 280px;
}
.state > .bi { font-size: 40px; color: var(--text-2); margin-bottom: var(--sp-1); }
.state h2 { font-size: var(--fs-md); }
.state p { color: var(--text-2); max-width: 46ch; }
.state .state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.state.is-error > .bi { color: var(--danger); }
.state-inline { min-height: 0; padding: var(--sp-5) var(--sp-4); }
.loading-line { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) 0; color: var(--text-2); }
.skeleton td { position: relative; }
.skeleton .sk { display: block; height: 12px; border-radius: var(--r-full); background: var(--bg-active); }

/* Sperr-Hinweis */
.lock-banner {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-3) var(--sp-5) 0; padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--warning); border-radius: var(--r-md); background: var(--warning-soft);
}
.lock-banner > .bi { font-size: 18px; color: var(--warning); }
.lock-banner p { flex: 1; min-width: 0; }

/* ════ Detailbereich ════ */
.details {
  grid-area: details;
  width: var(--details-w); min-height: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--bg);
}
.details-head { display: flex; align-items: center; gap: var(--sp-2); min-height: 56px; padding: 0 var(--sp-2) 0 var(--sp-4); border-bottom: 1px solid var(--line); }
.details-head h2 { flex: 1; font-size: var(--fs-md); }
.details-body { flex: 1; overflow-y: auto; padding: var(--sp-4); }
.details-preview {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; margin-bottom: var(--sp-4);
  border-radius: var(--r-md); background: var(--bg-hover); overflow: hidden; font-size: 56px;
}
.details-preview img { width: 100%; height: 100%; object-fit: contain; background: var(--bg-media); }
.details-name { font-size: var(--fs-md); font-weight: var(--fw-strong); overflow-wrap: anywhere; margin-bottom: var(--sp-3); }
.details-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.details-section + .details-section { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.details-section h3 { font-size: var(--fs-base); margin-bottom: var(--sp-3); }
.props { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); }
.props dt { color: var(--text-2); }
.props dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.props dd .where-link { white-space: normal; color: var(--accent); }
.details-note { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--sp-3); }
.details-link {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2);
}
.details-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════ Menüs ════ */
.menu {
  position: fixed; z-index: 500;
  min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto;
  padding: var(--sp-1);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg-raised); box-shadow: var(--shadow-1);
}
.menu-item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  min-height: 36px; padding: 0 var(--sp-3);
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text); font-size: var(--fs-base); text-align: left; text-decoration: none; white-space: nowrap;
}
.menu-item > .bi { width: 18px; text-align: center; font-size: 16px; color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-hover); color: var(--text); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.menu-item .menu-key { margin-left: auto; padding-left: var(--sp-4); color: var(--text-2); font-size: var(--fs-xs); }
.menu-item.danger, .menu-item.danger > .bi { color: var(--danger); }
.menu-item[aria-checked="true"] > .bi-check2 { color: var(--accent); }
.menu-item[aria-checked="false"] > .bi-check2 { visibility: hidden; }
.menu-item:disabled { opacity: 0.5; }
.menu-sep { height: 1px; margin: var(--sp-1) 0; background: var(--line); }
.menu-label { padding: var(--sp-2) var(--sp-3) var(--sp-1); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-strong); }
.menu-header { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); }
.menu-title { font-weight: var(--fw-strong); overflow: hidden; text-overflow: ellipsis; }

/* ════ Dialoge ════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: none; align-items: center; justify-content: center;
  padding: var(--sp-4);
  background: var(--scrim);
}
.modal-overlay.show { display: flex; }
.modal {
  display: flex; flex-direction: column;
  width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  border-radius: var(--r-lg); background: var(--bg-raised); box-shadow: var(--shadow-2);
  animation: modal-in var(--t-med) var(--ease-out);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 880px; }
.modal-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-3) var(--sp-2) var(--sp-5); }
.modal-title { flex: 1; min-width: 0; font-size: var(--fs-md); overflow-wrap: anywhere; }
.modal-body { padding: var(--sp-2) var(--sp-5) var(--sp-4); overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) var(--sp-4); }
.modal-foot .spacer { flex: 1; }
.modal-hint { color: var(--text-2); margin-bottom: var(--sp-4); }
.modal-body > .field:last-child { margin-bottom: 0; }

/* Freigabedialog */
.share-status { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.share-status > .bi { font-size: 20px; color: var(--text-2); margin-top: 1px; }
.share-status.on > .bi { color: var(--accent); }
.share-status p { color: var(--text-2); font-size: var(--fs-sm); }
.link-field { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.link-field input { font-family: var(--font-mono); font-size: var(--fs-sm); }
.link-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.link-raw { margin-bottom: var(--sp-4); }
.link-raw summary { display: flex; align-items: center; min-height: 32px; cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); }
.link-raw .link-field { margin-top: var(--sp-2); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.opt-row:first-child { border-top: 0; }
.opt-text { min-width: 0; }
.opt-text .label { display: block; }
.opt-row select, .opt-row input[type="number"], .opt-row input[type="password"] { width: 180px; flex-shrink: 0; }
.share-settings > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; font-weight: var(--fw-strong); }
.share-settings > summary::-webkit-details-marker { display: none; }
.share-settings > summary .bi { transition: transform var(--t-fast); color: var(--text-2); }
.share-settings[open] > summary .bi { transform: rotate(90deg); }
.opt-note { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--sp-1); }

/* Ordnerauswahl (Verschieben) */
.picker { border: 1px solid var(--line-strong); border-radius: var(--r-sm); max-height: 320px; overflow-y: auto; padding: var(--sp-1); }
.picker-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  min-height: 36px; padding: 0 var(--sp-2) 0 calc(var(--sp-2) + var(--depth, 0) * 16px);
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); text-align: left;
}
.picker-item:hover { background: var(--bg-hover); }
.picker-item[aria-selected="true"] { background: var(--bg-selected); font-weight: var(--fw-strong); }
.picker-item:disabled { color: var(--text-disabled); cursor: not-allowed; background: transparent; }
.picker-item > .bi { color: var(--type-folder); }
.picker-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-path { color: var(--text-2); font-size: var(--fs-sm); margin-left: auto; padding-left: var(--sp-2); }
.picker-filter { margin-bottom: var(--sp-3); }

.radio-list { display: flex; flex-direction: column; gap: var(--sp-1); }
.radio-list label { display: flex; align-items: center; gap: var(--sp-3); min-height: 36px; padding: 0 var(--sp-2); border-radius: var(--r-sm); cursor: pointer; }
.radio-list label:hover { background: var(--bg-hover); }

/* Versionen von Notizen */
.rev-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--sp-4); min-height: 320px; }
.rev-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow-y: auto; max-height: 60vh; }
.rev-item { display: block; width: 100%; padding: var(--sp-2) var(--sp-3); border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.rev-item:hover { background: var(--bg-hover); }
.rev-item.active { background: var(--bg-selected); }
.rev-date { display: block; font-weight: var(--fw-strong); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.rev-title { display: block; color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rev-preview { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); overflow-y: auto; max-height: 60vh; }
.rev-meta { color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.rev-empty { padding: var(--sp-4); color: var(--text-2); }

/* Tabellen in Dialogen und Einstellungen */
.dtable { width: 100%; border-collapse: collapse; }
.dtable th { text-align: left; padding: var(--sp-2) var(--sp-3); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-strong); border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtable td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable .num { text-align: right; white-space: nowrap; }
.dtable .actions { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* ════ Hinweise (Toasts) ════ */
.toasts {
  position: fixed; left: var(--sp-4); bottom: var(--sp-4); z-index: 600;
  display: flex; flex-direction: column-reverse; gap: var(--sp-2);
  width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 48px; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  background: #1f2328; color: #f0f2f4; box-shadow: var(--shadow-1);
  pointer-events: auto;
  animation: toast-in var(--t-med) var(--ease-out);
}
[data-theme="dark"] .toast { background: #e6e8eb; color: #1b1f24; }
.toast > .bi { font-size: 16px; flex-shrink: 0; }
.toast.success > .bi { color: #5fd085; }
.toast.error > .bi { color: #ff8a8a; }
[data-theme="dark"] .toast.success > .bi { color: #1a7f37; }
[data-theme="dark"] .toast.error > .bi { color: #c42b3a; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-action {
  flex-shrink: 0; min-height: 32px; padding: 0 var(--sp-3);
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: #86cdf5; font-weight: var(--fw-strong);
}
[data-theme="dark"] .toast-action { color: #0a6aa8; }
.toast-action:hover { background: rgba(127, 127, 127, 0.2); }
.toast-close { flex-shrink: 0; width: 32px; height: 32px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; opacity: 0.8; }
.toast-close:hover { opacity: 1; background: rgba(127, 127, 127, 0.2); }
.toast.fade-out { opacity: 0; transition: opacity var(--t-med); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ════ Übertragungen ════ */
.transfers {
  position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 40;
  display: flex; flex-direction: column;
  width: 380px; max-width: calc(100vw - 32px); max-height: min(60vh, 520px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-raised); box-shadow: var(--shadow-1);
  overflow: hidden;
}
.transfers-head { display: flex; align-items: center; gap: var(--sp-1); min-height: 52px; padding: 0 var(--sp-2) 0 var(--sp-4); }
.transfers-head h2 { flex: 1; min-width: 0; font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfers-summary { padding: 0 var(--sp-4) var(--sp-3); }
.transfers-summary .hint { display: block; margin-top: var(--sp-1); font-variant-numeric: tabular-nums; }
.transfers.collapsed .transfers-list, .transfers.collapsed .transfers-foot { display: none; }
.transfers-list { list-style: none; overflow-y: auto; border-top: 1px solid var(--line); }
.transfer { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-1) var(--sp-3); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line); }
.transfer:last-child { border-bottom: 0; }
.transfer .ficon { width: 32px; height: 32px; grid-row: 1 / span 3; align-self: start; }
.transfer-name { grid-column: 2; grid-row: 1; }
.transfer-status { grid-column: 2; grid-row: 2; }
.transfer-name { font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-status { color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.transfer-status.err { color: var(--danger); white-space: normal; }
.transfer .bar { grid-column: 2; grid-row: 3; margin-top: 2px; }
.transfer-actions { display: flex; align-items: center; gap: 2px; grid-row: 1 / span 2; grid-column: 3; }
.transfer-actions .btn { padding: 0 var(--sp-2); }
.transfers-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-2); border-top: 1px solid var(--line); }

/* ════ Ablegen (Dateien aus dem System) ════ */
.drop-overlay {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center; padding: var(--sp-6);
  border: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.drop-overlay-box { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-radius: var(--r-md); background: var(--accent); color: var(--on-accent); font-size: var(--fs-md); box-shadow: var(--shadow-1); }
.drop-overlay-box .bi { font-size: 22px; }
.drop-target > td, .drop-target.tile, .drop-target.tree-row, .drop-target.crumb, .drop-target.nav-item {
  background: var(--bg-selected) !important; box-shadow: inset 0 0 0 2px var(--accent);
}

/* ════ Vorschau / Galerie (immer dunkel) ════ */
.preview-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: none; flex-direction: column;
  background: var(--bg-media); color: var(--text);
}
.preview-overlay.show { display: flex; }
.preview-bar { display: flex; align-items: center; gap: var(--sp-2); min-height: 56px; padding: 0 var(--sp-2); background: #16181b; }
.preview-titles { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--sp-3); }
.preview-title { font-size: var(--fs-md); font-weight: var(--fw-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-count { color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.preview-actions { display: flex; align-items: center; gap: var(--sp-1); }
.preview-actions .btn { color: var(--text); }
.preview-body {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: auto; touch-action: pan-y pinch-zoom;
}
.preview-body img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.preview-body.zoomed { align-items: flex-start; justify-content: flex-start; }
.preview-body.zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.preview-body video { display: block; max-width: 100%; max-height: 100%; background: #000; }
.preview-body audio { width: min(520px, 90%); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body pre {
  align-self: stretch; width: min(100%, 960px); margin: 0 auto; padding: var(--sp-5);
  overflow: auto; background: var(--bg); color: var(--text);
  font: var(--fs-sm) / 1.6 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.preview-msg { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-2); max-width: 34rem; }
.preview-msg > .bi { font-size: 48px; }
.preview-msg.error > .bi { color: var(--danger); }
.preview-msg p { color: var(--text); }
.preview-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(30, 33, 37, 0.85); color: #fff; font-size: 20px;
}
.preview-nav:hover { background: rgba(60, 64, 70, 0.95); }
.preview-nav.prev { left: var(--sp-4); }
.preview-nav.next { right: var(--sp-4); }

/* ════ Notizen ════ */
.notes { display: grid; grid-template-columns: 300px minmax(0, 1fr); flex: 1; min-height: 0; }
.notes-pane-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.notes-pane-list .view-top { padding-bottom: var(--sp-3); }
.notes-filter { padding: 0 var(--sp-4) var(--sp-3); }
.notes-list { list-style: none; flex: 1; overflow-y: auto; padding: 0 var(--sp-2) var(--sp-4); }
.note-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%;
  padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text); text-align: left;
}
.note-item { text-decoration: none; }
.note-item:hover { background: var(--bg-hover); color: var(--text); }
.note-item.active { background: var(--bg-selected); }
.note-item-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-strong); min-width: 0; }
.note-item-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-meta { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.notes-pane-doc { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.note-bar { display: flex; align-items: center; gap: var(--sp-2); min-height: 56px; padding: var(--sp-2) var(--sp-5); border-bottom: 1px solid var(--line); }
.note-bar .note-heading { flex: 1; min-width: 0; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-bar .note-back { display: none; }
.note-doc { flex: 1; overflow-y: auto; padding: var(--sp-5); }
.note-save-status { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; margin-right: var(--sp-2); }
.note-save-status.err { color: var(--danger); }
.note-save-status.warn { color: var(--warning); }
.note-conflict { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin: var(--sp-3) var(--sp-5) 0; }
.note-conflict span { flex: 1 1 320px; }
.note-conflict-actions { display: flex; gap: var(--sp-2); }
.note-title-input { margin: 0; border: 0 !important; background: transparent !important; padding: 0 !important; font-size: var(--fs-lg) !important; font-weight: var(--fw-strong); min-height: 40px; }
.note-title-input:focus-visible { outline: none !important; box-shadow: none; }
.note-editor { display: grid; grid-template-columns: 1fr 1fr; flex: 1; min-height: 0; }
.note-editor textarea {
  height: 100%; resize: none; border: 0; border-radius: 0; padding: var(--sp-4) var(--sp-5);
  background: var(--bg); font: var(--fs-base) / 1.65 var(--font-mono);
}
.note-editor textarea:focus-visible { outline: none; box-shadow: inset 3px 0 0 var(--accent); }
.note-editor-preview { overflow-y: auto; padding: var(--sp-4) var(--sp-5); border-left: 1px solid var(--line); }
.note-tabs { display: none; }
.note-empty-doc { flex: 1; }

/* Markdown-Darstellung (Notizen, Versionen) */
.md { max-width: 72ch; line-height: 1.65; overflow-wrap: anywhere; }
.md > * + * { margin-top: var(--sp-3); }
.md h1, .md h2, .md h3 { margin-bottom: var(--sp-2); }
.md h1 { font-size: var(--fs-lg); }
.md h2 { font-size: var(--fs-md); }
.md h3 { font-size: var(--fs-base); }
.md code { padding: 1px 4px; border-radius: 4px; background: var(--bg-hover); }
.md pre { padding: var(--sp-3); border-radius: var(--r-sm); background: var(--bg-hover); overflow-x: auto; }
.md pre code { padding: 0; background: none; }
.md blockquote { margin-left: 0; padding-left: var(--sp-3); border-left: 3px solid var(--line-strong); color: var(--text-2); }
.md ul, .md ol { padding-left: var(--sp-5); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md-empty { color: var(--text-2); font-style: italic; }
.note-locked { max-width: 520px; margin: var(--sp-6) auto; }

/* ════ Einstellungsseiten (Laufwerk, Benutzer) ════ */
.settings-section { padding: var(--sp-5) 0; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; }
.settings-section > h2 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.settings-section > p, .settings-section .prose p { color: var(--text-2); max-width: 70ch; }
.settings-section > p + p { margin-top: var(--sp-2); }
.copy-rows { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.copy-row {
  display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-side);
}
.copy-row > .label { font-weight: var(--fw-normal); color: var(--text-2); font-size: var(--fs-sm); }
.copy-row code { font-size: var(--fs-sm); overflow-x: auto; white-space: nowrap; overflow-wrap: normal; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); margin-top: var(--sp-3); }
.inline-form .field { flex: 1 1 240px; margin: 0; }
.secret-box { margin-top: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--accent); border-radius: var(--r-md); background: var(--accent-soft); }
.secret-box h3 { font-size: var(--fs-base); margin: var(--sp-4) 0 var(--sp-2); }
.secret-box p { max-width: 70ch; }
.secret-box .copy-row { background: var(--bg); }
.howto { border-top: 1px solid var(--line); }
.howto > summary { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; cursor: pointer; font-weight: var(--fw-strong); list-style: none; }
.howto > summary::-webkit-details-marker { display: none; }
.howto > summary .bi { color: var(--text-2); transition: transform var(--t-fast); }
.howto[open] > summary .bi { transform: rotate(90deg); }
.howto-body { padding: 0 0 var(--sp-4) var(--sp-6); color: var(--text-2); max-width: 76ch; }
.howto-body > * + * { margin-top: var(--sp-2); }
.howto-body ol, .howto-body ul { padding-left: var(--sp-5); }
.howto-body li + li { margin-top: var(--sp-1); }
.howto-body strong { color: var(--text); }
.howto:last-child { border-bottom: 1px solid var(--line); }
.user-cell { display: flex; align-items: center; gap: var(--sp-3); }
.user-cell .avatar { width: 28px; height: 28px; font-size: var(--fs-sm); }
.quota-cell { min-width: 160px; }
.quota-cell .bar { margin-top: var(--sp-1); }

.shortcut-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-2) var(--sp-5); align-items: baseline; }
.shortcut-list dt { white-space: nowrap; }
.shortcut-list dd { margin: 0; color: var(--text-2); }
.install-steps { padding-left: var(--sp-5); }
.install-steps li + li { margin-top: var(--sp-2); }

/* ════ Handy: Leiste unten, Schaltfläche, Schubladen ════ */
.only-mobile, .tabbar, .fab, .sidebar-backdrop { display: none; }
.touch-only { display: none; }
.touch .touch-only { display: flex; }

@media (max-width: 1199px) {
  #app-shell.visible { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-areas: "top top" "side main"; }
  .details { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; z-index: 50; box-shadow: var(--shadow-2); }
}

@media (max-width: 899px) {
  :root { --sidebar-w: 272px; }
  #app-shell.visible { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-2); padding: 0 var(--sp-2); }
  .only-mobile { display: inline-flex; }
  .hide-mobile { display: none !important; }
  .topbar-brand { font-size: var(--fs-base); }
  .search { display: none; }
  .search.open { display: flex; position: absolute; inset: 0; z-index: 3; max-width: none; padding: 0 var(--sp-2); background: var(--bg); gap: var(--sp-1); }
  .search.open input { padding-right: 40px; }
  .search.open > .bi-search { display: none; }
  .search.open input { padding-left: var(--sp-3); }
  .search .search-kbd { display: none; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med);
    box-shadow: var(--shadow-2);
  }
  body.sidebar-open .sidebar { transform: none; visibility: visible; transition: transform var(--t-med) var(--ease-out); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
  .sidebar-scroll { padding-top: var(--sp-4); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    border-top: 1px solid var(--line); background: var(--bg);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--text-2); text-decoration: none; font-size: var(--fs-xs);
  }
  .tabbar a .bi { font-size: 20px; line-height: 1; padding: 2px 16px; border-radius: var(--r-full); }
  .tabbar a.active { color: var(--text); font-weight: var(--fw-strong); }
  .tabbar a.active .bi { background: var(--bg-selected); color: var(--accent); }
  .fab {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; right: var(--sp-4); bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--sp-4)); z-index: 35;
    width: 56px; height: 56px; border: 0; border-radius: 16px;
    background: var(--accent); color: var(--on-accent); font-size: 24px; box-shadow: var(--shadow-1);
  }
  .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  .view-top { padding: var(--sp-3) var(--sp-4) 0; }
  .view-body { padding: 0 var(--sp-4) calc(var(--sp-7) + 56px); }
  .view-actions .btn-label { display: none; }
  #files-actions, [data-upload-root] { display: none !important; }
  .view-actions .btn { padding: 0 var(--sp-3); }
  .crumbs li:not(:last-child):not(.crumb-back) { display: none; }
  .crumbs li + li::before { content: none; }
  .crumb-back .crumb { font-size: var(--fs-md); }
  .crumbs h1 { margin-left: 0 !important; padding-left: var(--sp-1); }

  /* Liste wird einspaltig, Größe/Datum/Freigabe stehen in der Unterzeile (nichts fällt weg) */
  .ftable thead { display: none; }
  .ftable td.c-date, .ftable td.c-size, .ftable td.c-share, .ftable td.c-where { display: none; }
  .ftable col.c-date, .ftable col.c-size, .ftable col.c-share, .ftable col.c-where { display: none; }
  .c-check { width: 0; padding: 0 !important; }
  .c-check input { display: none; }
  .selecting .c-check { width: 40px; padding-left: var(--sp-2) !important; }
  .selecting .c-check input { display: block; opacity: 1; width: 20px; height: 20px; }
  .ftable td { height: 60px; padding: 0 var(--sp-1); }
  .c-act { width: 48px; }
  .row-actions .quick { display: none; }
  .name-sub { display: block; }
  .name-cell { gap: var(--sp-3); }
  .ficon { width: 40px; height: 40px; font-size: 24px; }
  .name-link { font-size: var(--fs-md); white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-2); }
  .tiles-folders { grid-template-columns: 1fr; }
  .tile .row-check, .tile .tile-menu { opacity: 1; }
  .tile .row-check { display: none; }
  .selecting .tile .row-check { display: block; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 2px; }
  .photo .row-check { display: none; }
  .selecting .photo .row-check { display: block; opacity: 1; }
  .selbar { margin: 0; }
  .selbar .btn-label { display: none; }
  .details { position: fixed; inset: 0; z-index: 70; width: auto; border: 0; box-shadow: none; }
  .transfers {
    left: var(--sp-2); right: var(--sp-2); width: auto; max-width: none;
    bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--sp-2));
  }
  .toasts { left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--sp-3)); }
  .transfers:not([hidden]) ~ .toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 80px); }
  .preview-overlay .btn-label { display: none; }
  .preview-nav { width: 40px; height: 40px; }
  .preview-nav.prev { left: var(--sp-2); }
  .preview-nav.next { right: var(--sp-2); }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal-sm, .modal-lg { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; padding-bottom: var(--safe-b); }
  .modal-foot .btn { flex: 1; }
  .opt-row { flex-wrap: wrap; }
  .opt-row select, .opt-row input[type="number"], .opt-row input[type="password"] { width: 100%; }
  .rev-layout { grid-template-columns: 1fr; }
  .notes { grid-template-columns: 1fr; }
  .notes.doc-open .notes-pane-list { display: none; }
  .notes:not(.doc-open) .notes-pane-doc { display: none; }
  .notes-pane-list { border-right: 0; }
  .note-bar { padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-1); }
  .note-bar .note-back { display: inline-flex; }
  .note-bar .btn-label { display: none; }
  .note-doc { padding: var(--sp-4); }
  .note-editor { grid-template-columns: 1fr; }
  .note-editor .note-editor-preview { display: none; border-left: 0; }
  .note-editor.show-preview textarea { display: none; }
  .note-editor.show-preview .note-editor-preview { display: block; }
  .note-tabs { display: flex; gap: var(--sp-1); padding: var(--sp-2) var(--sp-4) 0; }
  .copy-row { grid-template-columns: minmax(0, 1fr) auto; }
  .copy-row > .label { grid-column: 1 / -1; padding-top: var(--sp-1); }
  .howto-body { padding-left: 0; }
  .lock-banner { margin: var(--sp-2) var(--sp-4) 0; flex-wrap: wrap; }
  .dtable .hide-narrow { display: none; }
  .login-form { padding: var(--sp-5) var(--sp-4); border: 0; background: transparent; }
  #login-screen { background: var(--bg); }
}

/* Eingabe mit dem Finger: größere Ziele, keine Hover-Abhängigkeit */
@media (pointer: coarse) {
  .row-check, .row-actions .quick, .tile .tile-menu { opacity: 1; }
  .icon-btn { width: var(--touch); height: var(--touch); }
  .icon-btn-sm { width: 40px; height: 40px; }
  .segmented .icon-btn { width: 40px; height: 36px; }
  .menu-item { min-height: 44px; }
  .nav-item { min-height: 44px; }
  .tree-row, .tree-link { min-height: 40px; }
  .tree-toggle { height: 40px; width: 32px; }
  input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea { font-size: var(--fs-md); min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .selbar .btn { min-width: 40px; justify-content: center; }
  .picker-item { min-height: 44px; }
  .tile .row-check { width: 24px; height: 24px; }
}

@media print {
  .topbar, .sidebar, .tabbar, .fab, .transfers, .toasts, .details { display: none !important; }
  body { overflow: visible; }
}

/* ════ Ergänzungen für Teilbereiche ════ */
.details-actions-inline { margin: var(--sp-3) 0 0; }
.ok-icon { color: var(--success); }
.err-icon { color: var(--danger); }
.shares-warn { margin-top: var(--sp-4); }
.only-mobile-inline { display: none; }
.field-fixed { flex: 0 0 auto !important; }
.select-short { width: 110px; }
.modal-hint-after { margin-top: var(--sp-4); }
#expiry-options { border: 0; padding: 0; margin: 0; }
.note-meta { margin-top: var(--sp-6); }
.tile-open { cursor: pointer; }
.c-kind { width: 140px; color: var(--text-2); font-size: var(--fs-sm); }
.c-num { width: 90px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.ftable th.c-num { text-align: right; }
.c-limits { width: 240px; }
.c-limits .badge + .badge { margin-left: 2px; }
.shares-table + .tiles-heading { margin-top: var(--sp-6); }
.trash-act { width: 236px; }
.trash-sub { display: none; }
.trash-kind { display: block; font-size: var(--fs-sm); }
.trash-table .name-link { cursor: default; }
.trash-table .name-link:hover { text-decoration: none; }
.users-table .actions { width: 56px; }
.shares-table .c-act { width: 190px; }
.loading-line { animation: appear 0s linear 300ms both; }
@keyframes appear { from { visibility: hidden; } to { visibility: visible; } }
.touch .row, .touch .tile, .touch .photo { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.details-preview.ficon, .details-preview { width: 100%; height: auto; }
.details-preview .play { position: absolute; font-size: 40px; color: #fff; }
.details-preview { position: relative; }
.note-empty-doc { height: 100%; }
.preview-overlay .icon-btn { color: var(--text); }
.preview-overlay .icon-btn:hover { background: rgba(255, 255, 255, 0.08); }

@media (max-width: 899px) {
  .only-mobile-inline { display: inline-block; }
  .crumb-back .crumb-text { display: none; }
  .crumb-back .crumb { padding: var(--sp-1); font-size: var(--fs-lg); }
  .c-kind, .c-num, .c-limits { display: none; }
  .ftable td.c-kind, .ftable td.c-num, .ftable td.c-limits { display: none; }
  .trash-sub { display: block; }
  .trash-kind { display: none; }
  .trash-act { width: 112px; }
  .trash-act .btn-label { display: none; }
  .ftable.trash-table .c-check { width: 40px; padding-left: var(--sp-2) !important; }
  .ftable.trash-table .c-check input { display: block; }
  .shares-table .row-actions .btn-label { display: none; }
  .name-where { display: block; }
}

/* Wenig Platz in der Zeile (Detailbereich offen, Tablet): Aktionen nur als Symbol */
@container (max-width: 720px) {
  .selbar .btn-label { display: none; }
  .selbar .btn { padding: 0 var(--sp-2); }
}
