:root {
  color-scheme: light;
  --bg: #f6f6f7;
  --panel: #ffffff;
  --panel-soft: #fbfbfc;
  --text: #111111;
  --muted: #666666;
  --line: #e7e7ea;
  --accent: #e2001a;
  --accent-bright: #ff1e38;
  --accent-dark: #b80016;
  --accent-soft: #fff0f2;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --sidebar: #111111;
  --sidebar-soft: #1a1a1c;
  --sidebar-muted: #a6a6ad;
  --radius: 18px;
  --shadow: 0 16px 46px rgba(17, 17, 17, .09);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
body { background-image: radial-gradient(circle at 80% -10%, rgba(226,0,26,.05), transparent 30%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* Branding */
.brand-logo { display: block; height: auto; max-width: 100%; }
.auth-logo { width: min(100%, 320px); margin: 0 0 24px; }
.sidebar-brand-card { background: #fff; border-radius: 16px; padding: 12px 13px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.sidebar-logo { width: 100%; }
.mobile-brand { min-width: 0; }
.mobile-logo { width: 185px; max-width: 52vw; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, rgba(255,30,56,.10), transparent 34%), linear-gradient(180deg, #ffffff 0%, #f6f6f7 100%); }
.auth-card { width: min(100%, 460px); background: rgba(255,255,255,.97); padding: 38px; border-radius: 24px; box-shadow: 0 24px 70px rgba(17,17,17,.12); border: 1px solid var(--line); }
.auth-card h1, .page-head h1, .dialog h2 { margin: 4px 0 10px; letter-spacing: -.035em; }
.auth-card h1 { font-size: clamp(28px, 6vw, 36px); }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .15em; font-size: 11px; font-weight: 850; color: var(--accent); }
.muted { color: var(--muted); }
.small-text { font-size: 13px; margin: 0; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
input, select { width: 100%; border: 1px solid #d8d8dc; background: #fff; border-radius: 12px; padding: 12px 13px; color: var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(226,0,26,.11); }

.btn { border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 780; transition: transform .12s ease, background .12s ease, box-shadow .12s ease; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; box-shadow: 0 8px 20px rgba(226,0,26,.19); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #ed1730, var(--accent-dark)); }
.btn.ghost { background: #f0f0f2; color: var(--text); }
.btn.ghost:hover { background: #e6e6e9; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.full { width: 100%; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #111111, #171719); color: white; padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; border-right: 1px solid rgba(255,255,255,.05); }
.nav { display: grid; gap: 7px; }
.nav button { position: relative; border: 0; text-align: left; padding: 12px 13px; border-radius: 12px; background: transparent; color: #c9c9cf; font-weight: 720; }
.nav button:hover { background: rgba(255,255,255,.06); color: white; }
.nav button.active { background: rgba(226,0,26,.16); color: #fff; box-shadow: inset 3px 0 0 var(--accent-bright); }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.current-user { display: grid; gap: 2px; padding: 0 4px; }
.current-user small { color: var(--sidebar-muted); text-transform: capitalize; }
.sidebar .btn.ghost { background: rgba(255,255,255,.08); color: white; }
.sidebar .btn.ghost:hover { background: rgba(255,255,255,.13); }

.content { min-width: 0; padding: 38px clamp(20px, 4vw, 56px); }
.mobile-header { display: none; }
.view { max-width: 1280px; margin: 0 auto; }
.page-head { margin-bottom: 24px; }
.page-head.split { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.page-head p { margin-bottom: 0; }
.page-head h1 { font-size: clamp(30px, 4vw, 42px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(17,17,17,.045); }

.upload-panel { padding: clamp(18px, 3vw, 30px); }
.drop-zone { min-height: 310px; border: 2px dashed #cfcfd4; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; background: linear-gradient(180deg, #fff, #fbfbfc); color: var(--muted); transition: border-color .15s ease, background .15s ease, transform .15s ease; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone.dragover { transform: scale(.995); }
.drop-zone strong { color: var(--text); font-size: 18px; }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; font-size: 29px; font-weight: 500; margin-bottom: 7px; box-shadow: 0 10px 24px rgba(226,0,26,.20); }
.selected-files { display: grid; gap: 8px; margin-top: 16px; }
.selected-file { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #f8f8f9; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.upload-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.progress-wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-top: 18px; font-size: 13px; color: var(--muted); }
.progress-track { width: 100%; height: 8px; background: #e5e5e8; overflow: hidden; border-radius: 999px; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-bright), var(--accent)); transition: width .2s ease; }

.segmented { display: inline-flex; background: #e9e9ec; padding: 4px; border-radius: 12px; }
.segmented .filter { border: 0; background: transparent; border-radius: 9px; padding: 8px 12px; font-weight: 750; color: var(--muted); }
.segmented .filter.active { background: white; color: var(--accent); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.media-card { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(17,17,17,.05); transition: transform .14s ease, box-shadow .14s ease; }
.media-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(17,17,17,.08); }
.media-thumb { width: 100%; aspect-ratio: 4 / 3; background: #e5e5e8; overflow: hidden; display: grid; place-items: center; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb button { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; }
.media-body { padding: 13px; display: grid; gap: 8px; }
.media-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 780; font-size: 14px; }
.media-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.media-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.media-actions a { text-decoration: none; text-align: center; }
.empty-state { grid-column: 1 / -1; padding: 56px 24px; text-align: center; background: white; border: 1px dashed #cfcfd4; border-radius: 16px; color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 26px; }

.table-wrap { overflow-x: auto; }
.user-table { width: 100%; border-collapse: collapse; min-width: 650px; }
.user-table th, .user-table td { padding: 15px 17px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.user-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.user-table tbody tr:last-child td { border-bottom: 0; }
.user-table tbody tr:hover { background: #fcfcfd; }
.user-name-wrap { display: flex; align-items: center; gap: 9px; font-weight: 780; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 780; background: var(--accent-soft); color: var(--accent-dark); }
.lock-badge { background: #ecfdf3; color: #027a48; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }

.dialog { width: min(92vw, 500px); border: 0; border-radius: 20px; padding: 26px; box-shadow: 0 30px 80px rgba(17,17,17,.24); }
.dialog::backdrop { background: rgba(17,17,17,.60); backdrop-filter: blur(3px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.preview-dialog { width: min(94vw, 1100px); max-height: 92vh; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.preview-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-content { display: grid; place-items: center; min-height: 200px; }
.preview-content img, .preview-content video { max-width: 100%; max-height: 75vh; border-radius: 12px; }

.toast { position: fixed; z-index: 100; right: 20px; top: 20px; max-width: min(90vw, 420px); padding: 12px 15px; border-radius: 12px; background: #111; color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(-8px); pointer-events: none; transition: .2s ease; border-left: 3px solid var(--accent); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #7f1717; border-left-color: #ff8080; }

.account-panel { max-width: 620px; padding: clamp(20px, 3vw, 30px); }
.account-actions { display: flex; justify-content: flex-end; }
.storage-warning { max-width: 1280px; margin: 0 auto 22px; padding: 15px 17px; border: 1px solid #f2aab3; border-radius: 14px; background: var(--accent-soft); color: #920012; box-shadow: 0 8px 20px rgba(226,0,26,.08); }
.storage-warning > div { display: grid; gap: 4px; }
.storage-warning strong { font-size: 15px; }
.storage-warning span { font-size: 13px; line-height: 1.45; }
.status-locked { background: rgba(185,28,28,.12); color: #b91c1c; }
.status-active { background: rgba(21,128,61,.12); color: #166534; }

.mobile-nav { display: none; }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .content { padding: 16px 16px 94px; }
  .mobile-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -2px 0 28px; padding: 8px 0 14px; border-bottom: 1px solid var(--line); }
  .page-head.split { align-items: stretch; flex-direction: column; }
  .segmented { align-self: flex-start; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-body { padding: 10px; }
  .media-meta { display: grid; }
  .media-actions { grid-template-columns: 1fr; }
  .drop-zone { min-height: 240px; }
  .auth-card { padding: 28px; }
  .auth-logo { width: min(100%, 290px); }
  .view::after { content: ''; display: block; height: 60px; }
  .mobile-nav { position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; padding: 6px; background: rgba(17,17,17,.97); border: 1px solid rgba(255,255,255,.06); border-radius: 16px; box-shadow: 0 14px 40px rgba(17,17,17,.24); }
  .mobile-nav button { border: 0; border-radius: 11px; padding: 11px 7px; background: transparent; color: #c9c9cf; font-weight: 760; font-size: 12px; }
  .mobile-nav button.active { background: rgba(226,0,26,.20); color: white; }
}

@media (max-width: 420px) {
  .media-grid { grid-template-columns: 1fr; }
  .mobile-logo { width: 155px; }
}


/* Version 010: Passwort-Reset und Video-Freigaben */
.text-button { border: 0; background: transparent; color: var(--accent); padding: 4px 0; text-align: left; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--accent-dark); }
.btn.share { background: #111; color: #fff; }
.btn.share:hover { background: #2a2a2d; }
.media-actions { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.access-user-list { max-height: 360px; overflow: auto; display: grid; gap: 8px; padding: 4px; }
.access-user-row { grid-template-columns: auto 1fr; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafafa; cursor: pointer; }
.access-user-row:hover { border-color: #c9c9cf; background: #fff; }
.access-user-row input { width: 18px; height: 18px; accent-color: var(--accent); }
