/* fhcloud – Gestaltung nach Lanshare: ruhige Tabelle, Monospace-Pfad, ein Akzent */
:root {
  --paper: #EDF0F5; --surface: #FFFFFF; --ink: #111823; --muted: #65738A;
  --line: #D8DFEA; --accent: #2B50EC; --accent-ink: #FFFFFF; --folder: #0F766E; --hover: #F4F7FC;
  --danger: #C2362B; --danger-soft: #FCEDEB; --ok: #1F7A4D; --shadow: 0 10px 30px rgba(17, 24, 35, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0B1017; --surface: #131A24; --ink: #E4EAF3; --muted: #8A98AD;
    --line: #232E3D; --accent: #7C9BFF; --accent-ink: #0B1017; --folder: #4FD1C5; --hover: #1A2330;
    --danger: #FF7A6E; --danger-soft: #2A1615; --ok: #5BD69A; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans) }
[hidden] { display: none !important }
.mono { font-family: var(--mono) }
.muted { color: var(--muted) }
.small { font-size: 13px }
.nowrap { white-space: nowrap }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0) }
a { color: var(--accent) }

.wrap { max-width: 980px; margin: 0 auto; padding: 32px 20px 120px }
.wrap.narrow { max-width: 760px }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted) }
.nav { display: flex; gap: 18px; align-items: baseline; font-size: 13px }
.nav a, .nav .link { color: var(--muted); text-decoration: none }
.nav a:hover, .nav .link:hover { color: var(--accent) }
.nav form { margin: 0 }
.pill { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--hover); border: 1px solid var(--line); font-size: 11px; text-align: center; color: var(--ink) }

h1.crumbs { margin: 10px 0 0; font: 600 19px/1.4 var(--mono); overflow-wrap: anywhere }
h1.crumbs a { color: var(--accent); text-decoration: none }
h1.crumbs a:hover { text-decoration: underline }
h1.crumbs .sep { color: var(--muted); font-weight: 400; margin: 0 .15em }
h1.crumbs.plain { color: var(--ink) }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin: 14px 0 18px }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; font-size: 13px; color: var(--muted); margin: 14px 0 18px }
.bar .meta { margin: 0 }
.meta a { color: var(--accent); text-decoration: none }
.meta a:hover { text-decoration: underline }
.actions { display: flex; gap: 8px; flex-wrap: wrap }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14px var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap
}
.btn:hover { border-color: var(--muted) }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.btn.primary:hover { filter: brightness(1.08) }
.btn.danger { color: var(--danger) }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger) }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff }
.btn.wide { width: 100%; justify-content: center; height: 40px }
.btn:disabled { opacity: .55; cursor: default }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer }
.link.danger { color: var(--danger) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

table.files { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.files th, .files td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle }
.files th { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600 }
.files tr:last-child td { border-bottom: none }
.files tbody tr:hover, .files tbody tr.selected { background: var(--hover) }
.files tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent) }
td.name { width: 100%; overflow-wrap: anywhere }
button.sort { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer }
button.sort:hover, button.sort.on { color: var(--ink) }
button.sort.on::after { content: " ▲"; font-size: 9px; color: var(--accent) }
button.sort.on[data-dir="ab"]::after { content: " ▼" }
.usage { display: inline-flex; align-items: center; gap: 8px }
.usebar { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden }
.usebar i { display: block; height: 100%; width: 0; background: var(--accent) }
.check { display: flex !important; gap: 8px; align-items: center; text-transform: none !important; letter-spacing: 0 !important; font-size: 14px !important; color: var(--ink) !important; margin-top: 16px !important; cursor: pointer }
.dlg .check input { width: 16px; height: 16px; accent-color: var(--accent) }
.folderlist { list-style: none; margin: 8px 0 0; padding: 4px; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--paper) }
.folderlist li.muted { padding: 8px 10px }
.folderlist button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; font: 13px var(--mono); color: var(--ink); cursor: pointer; overflow-wrap: anywhere }
.folderlist button:hover { background: var(--hover) }
.folderlist button.sel { background: var(--accent); color: var(--accent-ink) }
.folderlist button:disabled { color: var(--muted); cursor: default; background: none }
td.name a { color: var(--ink); text-decoration: none; font-weight: 500 }
td.name a:hover { color: var(--accent); text-decoration: underline }
tr.dir td.name a { color: var(--folder) }
.glyph { display: inline-block; width: 1.4em; color: var(--muted) }
.num, .date { white-space: nowrap; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums }
th.sel, td.sel { width: 1%; padding-right: 0 }
td.sel input, th.sel input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; vertical-align: middle }
td.act, th.act { white-space: nowrap; text-align: right; width: 1% }
td.act .link { font-size: 12px; color: var(--muted); margin-left: 10px }
td.act .link:hover { color: var(--accent); text-decoration: underline }
td.act .link.danger:hover { color: var(--danger) }
td.act .view { opacity: 0; transition: opacity .12s ease }
tr:hover .view, .view:focus-visible { opacity: 1 }
td.act .more { font-size: 15px; letter-spacing: -.05em; padding: 0 4px }
.empty { padding: 34px 16px !important; color: var(--muted); text-align: center }

/* Auswahl */
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 10px; align-items: center; padding: 8px 8px 8px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; z-index: 20
}

/* Menü an einer Zeile */
.menu { position: absolute; z-index: 30; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow) }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: 14px var(--sans); color: var(--ink); cursor: pointer }
.menu button:hover, .menu button:focus-visible { background: var(--hover); outline: none }
.menu button.danger { color: var(--danger) }

/* Ablegen per Drag & Drop */
.drop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); pointer-events: none }
.drop div { padding: 22px 30px; border: 2px dashed var(--accent); border-radius: 14px; background: var(--surface); font-weight: 600; color: var(--accent) }

/* Upload-Liste */
.uploads {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: min(380px, calc(100vw - 36px));
  max-height: 50vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 25
}
.uploads header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; position: sticky; top: 0; background: var(--surface) }
.uploads ul { list-style: none; margin: 0; padding: 4px 0 }
.uploads li { padding: 8px 14px; font-size: 13px }
.uploads .up-name { display: flex; justify-content: space-between; gap: 10px }
.uploads .up-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px }
.uploads .up-state { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums }
.uploads li.done .up-state { color: var(--ok) }
.uploads li.err .up-state { color: var(--danger); white-space: normal; text-align: right }
.progress { height: 3px; margin-top: 6px; border-radius: 2px; background: var(--line); overflow: hidden }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear }
.uploads li.done .progress i { background: var(--ok) }
.uploads li.err .progress i { background: var(--danger) }

/* Dialoge */
.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow) }
.dlg::backdrop { background: rgba(11, 16, 23, .45) }
.dlg h2 { margin: 0 0 14px; font-size: 17px }
.dlg label, .login label { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px }
.dlg input, .dlg select, .login input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: 15px var(--sans)
}
.dlg input:focus, .dlg select:focus, .login input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px }
.copyrow { display: flex; gap: 8px }
.copyrow input { font-family: var(--mono); font-size: 13px }
.error { color: var(--danger); font-size: 14px; margin: 10px 0 0 }

/* Anmeldung */
body.center { min-height: 100vh; display: grid; place-items: center; padding: 20px }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px }
.login { width: min(380px, 100%) }
.login h1 { margin: 6px 0 8px; font: 600 22px var(--mono) }
.login .btn { margin-top: 18px }

/* Vorschau */
.viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(6, 9, 14, .96); color: #fff }
.viewer::backdrop { background: rgba(6, 9, 14, .9) }
.viewer[open] { display: grid; grid-template: auto 1fr / 64px 1fr 64px }
.viewer-bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)) }
.viewer-name { font-size: 13px; color: #C9D3E3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.viewer-actions { display: flex; gap: 8px }
.viewer-stage { display: grid; place-items: center; min-height: 0; min-width: 0; padding: 0 0 20px }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; border-radius: 4px }
.viewer-stage audio { width: min(520px, 90vw) }
.viewer-stage iframe { width: 100%; height: calc(100vh - 90px); border: 0; background: #fff; border-radius: 4px }
.viewer-stage pre { width: min(900px, 100%); max-height: calc(100vh - 100px); overflow: auto; margin: 0; padding: 18px; background: #131A24; color: #E4EAF3; border-radius: 8px; font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word }
.viewer-nav { align-self: center; justify-self: center; width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 34px; line-height: 1; cursor: pointer }
.viewer-nav:hover { background: rgba(255, 255, 255, .16) }
.viewer-nav:disabled { visibility: hidden }

/* Infokarte für Dateien ohne Vorschau */
.infocard { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 30px; border-radius: 14px; background: #131A24; border: 1px solid #232E3D; max-width: min(460px, 90vw) }
.filebadge { display: grid; place-items: center; width: 74px; height: 92px; border-radius: 10px; background: #1A2330; border: 1px solid #2C3A4D; color: #7C9BFF; font: 600 14px var(--mono); margin-bottom: 8px }
.infoname { font: 600 15px var(--mono); color: #E4EAF3; overflow-wrap: anywhere }
.infometa { font-size: 13px; color: #8A98AD; font-variant-numeric: tabular-nums }
.infonote { margin: 4px 0 10px; font-size: 13px; color: #8A98AD }

/* Freigabe einer einzelnen Datei */
.sharefile { margin: 6px 0 18px }
.sharefile img, .sharefile video { display: block; max-width: 100%; max-height: 70vh; border-radius: 10px; border: 1px solid var(--line); background: var(--surface) }
.sharefile audio { width: 100% }
.sharefile iframe { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 10px; background: #fff }
.textview { max-height: 70vh; overflow: auto; margin: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(18px + env(safe-area-inset-top, 0px)); z-index: 60;
  padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px)
}
.toast.err { background: var(--danger); color: #fff }

@media (max-width: 680px) {
  .wrap { padding: 22px 12px 120px }
  .date.col-date, .col-date { display: none }
  .files th, .files td { padding: 10px 10px }
  td.act .view { display: none } /* Antippen des Namens öffnet die Vorschau */
  .num { font-size: 12px }
  .bar .actions { width: 100% }
  .bar .actions .btn { flex: 1; justify-content: center; padding: 0 8px }
  .viewer[open] { grid-template: auto 1fr auto / 1fr 1fr }
  .viewer-stage { grid-column: 1 / -1; grid-row: 2; padding: 0 8px }
  .viewer-nav { grid-row: 3; margin-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) }
  .viewer-nav.prev { grid-column: 1 }
  .viewer-nav.next { grid-column: 2 }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important } }
