/* ─────────────────────────────────────────────────────────────────────────────
   Poddie Storage — Oberfläche
   Folgt dem Poddie-Design-System aus poddie-frontend (tokens.css):
   warmer Off-White-Grund, Poddie-Orange als einziger Akzent, PoddieSans,
   flache Flächen mit feinen Rändern und sehr zurückhaltenden Schatten.
───────────────────────────────────────────────────────────────────────────── */

@import './tokens.css';

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-app);
  line-height: 1.5;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

:focus-visible { outline: 2px solid var(--color-orange); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: var(--color-orange-light); color: var(--text-primary); }

.mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Grundgerüst ─────────────────────────────────────────────────────────── */

#shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width var(--transition-slow);
}
#sidebar.collapsed { width: var(--sidebar-collapsed); }

.sb-logo {
  padding: var(--space-5) var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.sb-logo-group { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.sb-logo-mark {
  font-size: var(--text-xl);
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.sb-logo-sub {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-orange);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--color-orange-light);
  border: 1px solid rgba(200, 90, 42, .2);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  white-space: nowrap;
}
/* Eingeklappt bleibt der Knopf stehen — sonst gaebe es keinen Weg
   zurueck in die volle Breite. Das Wortzeichen schrumpft auf das `p`,
   genau wie in Poddie Ops. */
#sidebar.collapsed .sb-logo { padding-left: var(--space-2); padding-right: var(--space-2); }
#sidebar.collapsed .sb-logo-group { display: none; }
#sidebar.collapsed .sb-logo-collapsed { display: block; }
.sb-logo-collapsed {
  display: none;
  flex: 1;
  text-align: center;
  font-size: var(--text-xl);
  font-weight: 900;
  color: var(--color-orange);
  letter-spacing: -.5px;
  line-height: 1;
}

.sb-collapse,
.sb-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: none; background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-disabled);
  cursor: pointer; flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.sb-collapse:hover, .sb-icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.sb-nav {
  flex: 1;
  padding: var(--space-3) var(--space-2);
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto; overflow-x: hidden;
}

.sb-section {
  padding: var(--space-4) var(--space-3) var(--space-1);
  font-size: 9px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-disabled);
  white-space: nowrap;
}
#sidebar.collapsed .sb-section { display: none; }

.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none; background: transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--color-orange-subtle); color: var(--color-orange); }
.nav-item.active .nav-icon { opacity: 1; color: var(--color-orange); }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; opacity: .75; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: var(--space-2); }
#sidebar.collapsed .nav-label { display: none; }

.sb-bottom {
  padding: var(--space-3);
  border-top: 1px solid var(--border-default);
  display: flex; flex-direction: column; gap: var(--space-2);
  flex-shrink: 0;
}
.sb-user {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%;
  padding: var(--space-2);
  border: none; background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer; text-align: left; overflow: hidden;
  font-family: var(--font-sans);
  transition: background var(--transition-fast);
}
.sb-user:hover { background: var(--bg-hover); }
.avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--color-orange);
  color: #fff;
  font-size: var(--text-xs); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sb-user-info { display: flex; flex-direction: column; min-width: 0; }
.sb-user-name { font-size: var(--text-xs); font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: 10px; color: var(--text-tertiary); }
#sidebar.collapsed .sb-user-info { display: none; }
#sidebar.collapsed .sb-user { justify-content: center; }
.sb-bottom-row { display: flex; align-items: center; gap: var(--space-1); }
#sidebar.collapsed .sb-bottom-row { flex-direction: column; }

.lang-switcher { display: flex; gap: 2px; margin-left: auto; }
#sidebar.collapsed .lang-switcher { display: none; }
.lang-btn {
  border: none; background: transparent;
  font-family: var(--font-sans); font-size: 10px; font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-disabled);
  padding: 3px 5px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.lang-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.lang-btn.active { color: var(--color-orange); background: var(--color-orange-light); }

/* ── Ordnerbaum ──────────────────────────────────────────────────────────── */

#sidebarTree { display: flex; flex-direction: column; gap: 1px; padding-top: 2px; }
#sidebar.collapsed #sidebarTree { display: none; }

.tree-row {
  display: flex; align-items: center; gap: 5px;
  padding: 5px var(--space-2) 5px 0;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.tree-row:hover { background: var(--bg-hover); color: var(--text-primary); }
.tree-row.active { background: var(--color-orange-subtle); color: var(--color-orange); font-weight: 600; }
.tree-arrow {
  display: flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex-shrink: 0;
  color: var(--text-disabled);
  transition: transform var(--transition-fast);
}
.tree-arrow.open { transform: rotate(90deg); }
.tree-icon { display: flex; align-items: center; flex-shrink: 0; opacity: .8; }
.tree-row.active .tree-icon { opacity: 1; }
.tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { display: flex; flex-direction: column; gap: 1px; }
.tree-loading { font-size: var(--text-xs); color: var(--text-disabled); padding: 4px 0 4px 26px; }

/* ── Hauptbereich ────────────────────────────────────────────────────────── */

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.topbar-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: fadeIn var(--transition-base) both; }
.view[hidden] { display: none; }
.view-scroll { flex: 1; overflow-y: auto; padding: var(--space-6) var(--space-8); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 8px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  font-family: var(--font-sans);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-strong); background: var(--bg-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--color-orange);
  border-color: var(--color-orange);
  color: #fff;
  font-weight: var(--weight-semibold);
}
.btn-primary:hover:not(:disabled) { background: var(--color-orange-hover); border-color: var(--color-orange-hover); color: #fff; }

.btn-danger { color: #dc2626; border-color: rgba(220, 38, 38, .25); background: var(--bg-elevated); }
.btn-danger:hover:not(:disabled) { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .45); color: #dc2626; }
.btn-danger-solid { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: var(--weight-semibold); }
.btn-danger-solid:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: transparent; }

.btn-sm { padding: 5px 10px; font-size: var(--text-xs); }
.btn-icon { padding: 6px; }

/* ── Eingabefelder ───────────────────────────────────────────────────────── */

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-disabled); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-orange);
  background: var(--bg-surface);
}
.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A756D' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.textarea { resize: none; line-height: 1.5; }

.search-wrap { position: relative; width: 300px; }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-tertiary); display: flex; pointer-events: none;
}
.search-wrap .input { padding-left: 34px; background: var(--bg-app); }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.field-hint { font-size: var(--text-xs); color: var(--text-tertiary); line-height: 1.5; }
.field-row { display: flex; gap: var(--space-3); }
.field-row > .field { flex: 1; min-width: 0; }

/* ── Karten & Tabellen ───────────────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-pad { padding: var(--space-5) var(--space-6); }
.card-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.card-sub { font-size: var(--text-xs); color: var(--text-tertiary); }

table.data { width: 100%; border-collapse: collapse; }
table.data th {
  padding: 10px 16px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  white-space: nowrap;
}
table.data td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--transition-fast); }
table.data tbody tr:hover { background: var(--bg-hover); }
.cell-num { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .row-actions { display: inline-flex; gap: var(--space-2); opacity: 0; transition: opacity var(--transition-fast); }
table.data tbody tr:hover .row-actions { opacity: 1; }
.cell-empty { padding: var(--space-12); text-align: center; color: var(--text-tertiary); font-size: var(--text-sm); }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-5);
}
.page-title { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: 1.2; }
.page-sub { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: var(--space-1); }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: var(--weight-semibold);
  letter-spacing: .02em; white-space: nowrap;
}
.badge-admin { background: rgba(200, 90, 42, .10); color: var(--color-orange); border-color: rgba(200, 90, 42, .25); }
.badge-user { background: rgba(107, 114, 128, .10); color: var(--text-tertiary); border-color: var(--border-default); }
.badge-active { background: var(--status-shipped-bg); color: var(--status-shipped-text); border-color: rgba(45, 125, 94, .22); }
.badge-invited { background: var(--status-ready-bg); color: var(--status-ready-text); border-color: rgba(180, 120, 40, .22); }
.badge-you { background: var(--status-production-bg); color: var(--status-production-text); border-color: rgba(74, 111, 165, .22); }

/* ── Explorer ────────────────────────────────────────────────────────────── */

#breadcrumbBar {
  display: flex; align-items: center;
  padding: var(--space-3) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
#breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); flex-wrap: wrap; }
.bc-item { color: var(--text-tertiary); }
.bc-item.bc-link { color: var(--text-secondary); cursor: pointer; }
.bc-item.bc-link:hover { color: var(--color-orange); }
.bc-item:last-child { color: var(--text-primary); font-weight: var(--weight-medium); }
.bc-sep { color: var(--text-disabled); }

#fileListArea {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: var(--space-5) var(--space-8) var(--space-8);
  position: relative;
}
#fileListArea.drag-over::after {
  content: '';
  position: absolute; inset: var(--space-4);
  border: 2px dashed var(--color-orange);
  border-radius: var(--radius-lg);
  background: var(--color-orange-subtle);
  pointer-events: none;
}

table.data tr.item-row { cursor: default; }
table.data tr.item-row.selected { background: var(--bg-selected); }
.col-icon { width: 40px; }
.col-type { width: 90px; color: var(--text-tertiary); }
.col-size { width: 100px; }
.col-by { width: 140px; }
.col-actions { width: 110px; }
.item-icon { display: flex; align-items: center; color: var(--text-tertiary); }
.item-name { display: inline-flex; align-items: center; }
.item-name.folder-link { cursor: pointer; font-weight: var(--weight-medium); }
.item-name.folder-link:hover { color: var(--color-orange); }

#loadingOverlay {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg-app) 70%, transparent);
  z-index: 5;
}
#loadingOverlay.on { display: flex; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-default);
  border-top-color: var(--color-orange);
  animation: spin 600ms linear infinite;
}

/* ── Overlay, Modal ──────────────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  animation: fadeIn 140ms ease both;
}
.overlay[hidden] { display: none !important; }

.modal {
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 4rem);
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: riseIn 180ms ease both;
}
.modal-wide { max-width: 680px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-title {
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: .06em;
}
.modal-sub { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0;
  border: none; background: none; border-radius: var(--radius-sm);
  color: var(--text-tertiary); cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: var(--space-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-5); }
.modal-foot {
  display: flex; gap: var(--space-3); justify-content: flex-end;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-text { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; }
.modal-text strong { color: var(--text-primary); font-weight: var(--weight-semibold); }

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.55;
  border: 1px solid transparent;
}
.notice-error { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .22); color: #b91c1c; }
.notice-warn { background: var(--status-ready-bg); border-color: rgba(180, 120, 40, .25); color: var(--status-ready-text); }
.notice-info { background: var(--color-orange-subtle); border-color: rgba(200, 90, 42, .2); color: var(--text-secondary); }
.notice-ok { background: var(--status-shipped-bg); border-color: rgba(45, 125, 94, .22); color: var(--status-shipped-text); }

/* ── Einladungs-Code ─────────────────────────────────────────────────────── */

.code-display {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.code-value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--text-primary);
  word-break: break-all;
}

/* ── Codeblöcke (Embed) ──────────────────────────────────────────────────── */

.code-block { position: relative; }
.code-block code {
  display: block;
  padding: var(--space-3) var(--space-4);
  padding-right: 72px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}
.code-block .copy-btn { position: absolute; top: 8px; right: 8px; }

.radio-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-sunken);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.radio-row:hover { border-color: var(--border-strong); }
.radio-row input { accent-color: var(--color-orange); margin-top: 2px; flex-shrink: 0; }
.radio-row strong { font-weight: var(--weight-semibold); }
.radio-row span { color: var(--text-secondary); }

.kv { display: flex; flex-direction: column; gap: var(--space-2); }
.kv-row { display: flex; gap: var(--space-4); font-size: var(--text-sm); }
.kv-key { width: 120px; flex-shrink: 0; color: var(--text-tertiary); }
.kv-val { color: var(--text-primary); min-width: 0; word-break: break-word; }

/* ── Upload ──────────────────────────────────────────────────────────────── */

.upload-row {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.upload-row:last-child { border-bottom: none; }
.upload-row-head { display: flex; align-items: baseline; gap: var(--space-2); }
.upload-row-name { font-size: var(--text-sm); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row-size { font-size: var(--text-xs); color: var(--text-tertiary); margin-left: auto; white-space: nowrap; font-family: var(--font-mono); }

#uploadProgressList {
  position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: 300;
  display: flex; flex-direction: column; gap: var(--space-2);
  width: 320px;
}
.progress-item {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: riseIn 180ms ease both;
}
.progress-name { font-size: var(--text-xs); font-weight: var(--weight-medium); display: flex; gap: var(--space-2); }
.progress-name span { margin-left: auto; color: var(--text-tertiary); font-family: var(--font-mono); }
.progress-track { height: 3px; margin-top: 8px; background: var(--bg-sunken); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--color-orange); border-radius: var(--radius-full); transition: width 120ms linear; }
.progress-item.done .progress-fill { background: var(--status-shipped-text); }
.progress-item.error .progress-fill { background: #dc2626; }
.progress-msg { font-size: var(--text-xs); color: #b91c1c; margin-top: 6px; line-height: 1.45; }

/* ── Kontextmenü ─────────────────────────────────────────────────────────── */

#contextMenu {
  position: fixed; z-index: 400;
  min-width: 170px; padding: var(--space-1);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
#contextMenu[hidden] { display: none !important; }
.ctx-item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: 7px var(--space-3);
  border: none; background: none; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: var(--text-sm);
  color: var(--text-secondary); text-align: left; cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ctx-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.ctx-item.danger { color: #dc2626; }
.ctx-item.danger:hover { background: rgba(220, 38, 38, .08); }
.ctx-sep { height: 1px; margin: var(--space-1) 0; background: var(--border-subtle); }

/* ── Toasts ──────────────────────────────────────────────────────────────── */

#toasts {
  position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: var(--space-2);
  align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--text-tertiary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
  max-width: 460px;
  animation: riseIn 180ms ease both;
}
.toast-ok { border-left-color: var(--status-shipped-text); }
.toast-error { border-left-color: #dc2626; }
.toast-info { border-left-color: var(--color-orange); }

/* ── Wartung ─────────────────────────────────────────────────────────────── */

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.result-box { font-size: var(--text-sm); color: var(--text-secondary); }
.result-box:empty { display: none; }

/* ── Anmeldeseite ────────────────────────────────────────────────────────── */

body.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--space-6);
}
.auth-box { width: 100%; max-width: 400px; }
.auth-brand {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  margin-bottom: var(--space-6);
}
.auth-brand-mark { font-size: var(--text-2xl); font-weight: 900; letter-spacing: -.6px; }
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.auth-heading { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.auth-switch { text-align: center; font-size: var(--text-sm); color: var(--text-tertiary); }
.auth-switch button {
  border: none; background: none; padding: 0;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--color-orange); cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-foot { margin-top: var(--space-5); text-align: center; }

/* ── Schmale Fenster ─────────────────────────────────────────────────────── */

/* Die Seitenleiste bleibt im Fluss. Ein `position: fixed` würde sie über den
   Inhalt legen, ohne dass der Hauptbereich Platz macht — dann steckt die halbe
   Tabelle darunter. Stattdessen wird sie schmaler, und wer mehr Platz braucht,
   klappt sie ganz weg. */
@media (max-width: 1000px) {
  :root { --sidebar-width: 190px; }
  /* Bei 190px stößt das STORAGE-Schild gegen den Einklapp-Knopf. Der Wortmarke
     allein fehlt nichts — welches System das ist, sagt auch der Seitentitel. */
  .sb-logo-sub { display: none; }
  .search-wrap { width: 190px; }
  .col-by { display: none; }
  .view-scroll, #fileListArea { padding-left: var(--space-5); padding-right: var(--space-5); }
  #breadcrumbBar { padding-left: var(--space-5); padding-right: var(--space-5); }
  .topbar { padding-left: var(--space-5); padding-right: var(--space-5); }
}

@media (max-width: 760px) {
  #sidebar.collapsed { width: 0; border-right: none; }
  .col-type { display: none; }
  .search-wrap { width: 140px; }
  .topbar { gap: var(--space-2); }
  .topbar-title { display: none; }
  #uploadProgressList { right: var(--space-3); left: var(--space-3); width: auto; }
}

/* Die Karte bekommt die Tabelle nicht immer klein genug — Dateinamen brechen
   nicht. Statt die Seite waagerecht scrollen zu lassen, scrollt die Karte. */
.card { overflow-x: auto; }
table.data { min-width: 520px; }

/* QUICK-TICKET (temporär): der Knopf erbt sonst die Zeilenhöhe der Seite,
   die Nav-Einträge hier sind <button> mit Browser-Zeilenhöhe. */
#sidebar [data-quick-ticket] { line-height: normal; }
