/* cloud-dateien – schlichtes, ruhiges Layout. Farben als Tokens, dunkles Schema automatisch. */

:root {
  --bg: #f6f6f7;
  --flaeche: #ffffff;
  --text: #1c1c1e;
  --text-leise: #6b7280;
  --rand: #e4e5e8;
  --hover: #f1f2f4;
  --akzent: #3f6ea8;
  --akzent-text: #ffffff;
  --akzent-leicht: #e9f0f8;
  --gefahr: #b4232c;
  --radius: 8px;
  --schatten: 0 1px 2px rgba(0, 0, 0, .05);
  --schatten-stark: 0 12px 32px rgba(0, 0, 0, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --flaeche: #1b1c20;
    --text: #e9e9ec;
    --text-leise: #9a9ca4;
    --rand: #2b2d33;
    --hover: #24262c;
    --akzent: #7aa6dc;
    --akzent-text: #0f1a28;
    --akzent-leicht: #1f2a39;
    --gefahr: #ef5a60;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4);
    --schatten-stark: 0 12px 32px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ikon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Kopf ------------------------------------------------------------- */
.kopf { position: sticky; top: 0; z-index: 10; background: var(--flaeche); border-bottom: 1px solid var(--rand); }
.kopf-innen { max-width: 1100px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marke { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 17px; }
.marke .ikon { width: 22px; height: 22px; color: var(--akzent); }
.kopf-rechts { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nutzer { color: var(--text-leise); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Inhalt ----------------------------------------------------------- */
.inhalt { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; }
.brotkrumen { font-size: 14px; color: var(--text-leise); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-height: 22px; }
.brotkrumen a { color: var(--text-leise); text-decoration: none; padding: 2px 4px; border-radius: 4px; }
.brotkrumen a:hover { color: var(--text); background: var(--hover); }
.brotkrumen .aktuell { color: var(--text); font-weight: 600; padding: 2px 4px; }
.brotkrumen .trenner { opacity: .55; }

.leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 14px; }
.leiste-gruppe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auswahl-anzahl { font-size: 14px; color: var(--text-leise); margin-right: 4px; }
.filter { margin-left: auto; width: 190px; max-width: 100%; }

input[type="text"], input[type="search"], input[type="password"], input:not([type]) {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: var(--radius); padding: 8px 11px; min-width: 0;
}
input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; border-color: transparent; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--akzent); cursor: pointer; }

/* ---- Knoepfe ---------------------------------------------------------- */
.knopf {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 7px 12px; cursor: pointer; white-space: nowrap; box-shadow: var(--schatten);
}
.knopf:hover { background: var(--hover); }
.knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf .ikon { width: 16px; height: 16px; }
.knopf-primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf-primaer:hover { background: color-mix(in srgb, var(--akzent) 88%, black); }
.knopf-leise { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-leise); }
.knopf-leise:hover { color: var(--text); background: var(--hover); }
.knopf-gefahr { color: var(--gefahr); }
.knopf-breit { justify-content: center; width: 100%; padding: 10px 12px; }
.knopf-x { font: inherit; font-size: 20px; line-height: 1; background: none; border: 0; color: var(--text-leise); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.knopf-x:hover { color: var(--text); background: var(--hover); }

/* ---- Liste ------------------------------------------------------------ */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; box-shadow: var(--schatten); overflow: hidden; }
.liste { width: 100%; border-collapse: collapse; table-layout: fixed; }
.liste th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-leise); padding: 10px 12px; border-bottom: 1px solid var(--rand); white-space: nowrap;
}
.sortier { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; text-transform: inherit; }
.sortier:hover { color: var(--text); }
.sortier.aktiv { color: var(--text); }
.sortier.aktiv::after { content: " ↑"; }
.sortier.aktiv.ab::after { content: " ↓"; }
.liste td { padding: 0 12px; height: 46px; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.liste tbody tr:last-child td { border-bottom: 0; }
.liste tbody tr:hover { background: var(--hover); }
.liste tbody tr.gewaehlt { background: var(--akzent-leicht); }
.sp-wahl { width: 40px; padding-right: 0 !important; }
.sp-groesse, .sp-datum { white-space: nowrap; color: var(--text-leise); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sp-groesse { width: 104px; text-align: right !important; }
.sp-datum { width: 136px; }
.sp-aktionen { width: 120px; white-space: nowrap; text-align: right; }
.name { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name:hover span { text-decoration: underline; text-underline-offset: 2px; }
.name .ikon { width: 20px; height: 20px; color: var(--text-leise); }
.name.ordner .ikon { color: var(--akzent); fill: color-mix(in srgb, var(--akzent) 18%, transparent); }
.aktion {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 6px; color: var(--text-leise); cursor: pointer; opacity: 0; transition: opacity .12s;
}
.aktion .ikon { width: 17px; height: 17px; }
.liste tbody tr:hover .aktion, .liste tbody tr:focus-within .aktion, .liste tbody tr.gewaehlt .aktion { opacity: 1; }
.aktion:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.aktion.gefahr:hover { color: var(--gefahr); }
.aktion:disabled { opacity: 0 !important; pointer-events: none; }
@media (hover: none) { .aktion { opacity: 1; } }
.hinweis-flaeche { margin: 0; padding: 48px 16px; text-align: center; color: var(--text-leise); }
.hinweis-flaeche small { display: block; margin-top: 4px; font-size: 13px; }
.speicher { margin: 14px 4px 0; font-size: 13px; color: var(--text-leise); }

@media (max-width: 640px) {
  .sp-datum { display: none; }
  .filter { width: 100%; margin-left: 0; }
  .nutzer { display: none; }
  /* Auf dem Handy nur der Download-Knopf in der Zeile; Umbenennen und Loeschen laufen ueber die Auswahl. */
  .sp-aktionen { width: 48px; }
  .aktion[data-aktion="umbenennen"], .aktion[data-aktion="loeschen"] { display: none; }
}
@media (max-width: 460px) { .sp-groesse { display: none; } }

/* ---- Ablagebereich (Drag & Drop) -------------------------------------- */
.ablage { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--akzent) 10%, transparent); pointer-events: none; padding: 14px; }
.ablage-rahmen {
  height: 100%; border: 2px dashed var(--akzent); border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; color: var(--akzent);
  background: color-mix(in srgb, var(--flaeche) 70%, transparent);
}

/* ---- Upload-Tafel ----------------------------------------------------- */
.uploads {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; width: min(380px, calc(100vw - 32px)); max-height: 50vh;
  display: flex; flex-direction: column; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; box-shadow: var(--schatten-stark);
}
.uploads-kopf { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--rand); font-weight: 600; font-size: 14px; }
.uploads-liste { list-style: none; margin: 0; padding: 6px 0; overflow: auto; }
.uploads-liste li { padding: 6px 14px; font-size: 13px; }
.u-zeile { display: flex; justify-content: space-between; gap: 10px; }
.u-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-status { color: var(--text-leise); flex: none; font-variant-numeric: tabular-nums; }
.u-status .ikon { width: 14px; height: 14px; vertical-align: -2px; color: #2e8b57; }
.u-balken { height: 4px; background: var(--rand); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.u-balken span { display: block; height: 100%; width: 0; background: var(--akzent); transition: width .15s; }
li.u-fertig .u-balken span { background: #2e8b57; }
li.u-fehler .u-balken span { background: var(--gefahr); }
.u-fehler-text { color: var(--gefahr); margin-top: 2px; }

/* ---- Anmeldung -------------------------------------------------------- */
.anmeldung { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.anmelde-karte {
  width: 100%; max-width: 360px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
  padding: 28px; display: grid; gap: 14px; box-shadow: var(--schatten);
}
.anmelde-karte h1 { margin: 0 0 2px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.anmelde-karte h1 .ikon { width: 26px; height: 26px; color: var(--akzent); }
.anmelde-hinweis { margin: -8px 0 4px; color: var(--text-leise); font-size: 14px; }
.anmelde-karte label { display: grid; gap: 6px; font-size: 13px; color: var(--text-leise); }
.anmelde-karte input { font-size: 15px; }
.anmelde-fehler { margin: 0; color: var(--gefahr); font-size: 14px; }
.anmelde-fuss { margin: 4px 0 0; font-size: 12.5px; color: var(--text-leise); }

/* ---- Dialog ----------------------------------------------------------- */
dialog {
  border: 0; border-radius: 12px; padding: 0; width: min(420px, calc(100vw - 32px));
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-stark);
}
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog form { padding: 22px; display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 17px; }
dialog p { margin: 0; color: var(--text-leise); font-size: 14px; }
dialog p:empty { display: none; }
.dialog-knoepfe { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; margin-top: 6px; }

/* ---- Meldungen -------------------------------------------------------- */
.meldungen { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; max-width: calc(100vw - 32px); }
.meldung { background: #1f2024; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 14px; box-shadow: var(--schatten-stark); }
.meldung-fehler { background: var(--gefahr); }

/* ---- Einsortieren-Menue, Umschalter, Badge ----------------------------- */
.knopf-akzent { border-color: color-mix(in srgb, var(--akzent) 45%, var(--rand)); color: var(--akzent); }
.knopf-klein { padding: 4px 9px; font-size: 13px; box-shadow: none; }
.menue-anker { position: relative; }
.menue {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 25; width: min(360px, calc(100vw - 32px));
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; box-shadow: var(--schatten-stark); padding: 10px 12px 12px;
}
.menue-text { margin: 0 0 8px; font-size: 13px; color: var(--text-leise); }
.menue-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--rand); font-size: 14px; }
.menue-knoepfe { display: flex; gap: 6px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--akzent); color: var(--akzent-text); font-size: 11.5px; line-height: 18px; text-align: center; }
.leiste-rechts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.umschalter { display: inline-flex; border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; background: var(--flaeche); box-shadow: var(--schatten); }
.umschalter-knopf { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13.5px; padding: 7px 10px; border: 0; background: transparent; color: var(--text-leise); cursor: pointer; }
.umschalter-knopf + .umschalter-knopf { border-left: 1px solid var(--rand); }
.umschalter-knopf.aktiv { background: var(--akzent-leicht); color: var(--text); }
.umschalter-knopf .ikon { width: 15px; height: 15px; }
@media (max-width: 640px) { .leiste-rechts { width: 100%; } .umschalter-knopf span { display: none; } }

/* ---- Ablagezonen beim Ziehen ------------------------------------------- */
.ablage { pointer-events: auto; }
.ablage-zonen { height: 100%; display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.ablage-zonen.ohne-sortier, .ablage-zonen.nur-sortier { grid-template-columns: 1fr; }
.zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px dashed var(--akzent); border-radius: 14px; color: var(--akzent); background: color-mix(in srgb, var(--flaeche) 72%, transparent);
  font-size: 18px; transition: background .1s, transform .1s;
}
.zone small { font-size: 13px; color: var(--text-leise); }
.zone.aktiv { background: color-mix(in srgb, var(--akzent) 18%, var(--flaeche)); transform: scale(1.01); }
.zone-sortier-gruppe { display: grid; grid-template-rows: repeat(3, 1fr); gap: 12px; }
.zone-sortier { border-style: solid; border-color: color-mix(in srgb, var(--akzent) 40%, transparent); font-size: 16px; }
@media (max-width: 640px) { .ablage-zonen { grid-template-columns: 1fr; grid-template-rows: 1fr 1.6fr; } .zone { font-size: 15px; } }

/* ---- Baumansicht ----------------------------------------------------- */
.baum-kopf { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--rand); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-leise); }
.baum-kopf-rechts { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.baum { padding: 8px 12px 10px; overflow-x: auto; }
.baum ul { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.baum > ul { padding-left: 0; }
.baum ul ul::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 12px; border-left: 1px solid var(--rand); }
.baum li { position: relative; }
.baum ul ul > li::before { content: ""; position: absolute; left: -15px; top: 17px; width: 12px; border-top: 1px solid var(--rand); }
.knoten { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px; border-radius: 6px; min-width: 0; }
.knoten:hover { background: var(--hover); }
.knoten.aktuell { background: var(--akzent-leicht); }
.pfeil { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--text-leise); cursor: pointer; border-radius: 4px; flex: none; }
.pfeil .ikon { width: 14px; height: 14px; transition: transform .12s; }
.pfeil.offen .ikon { transform: rotate(90deg); }
.pfeil.leer { visibility: hidden; }
.knoten .name { flex: 1; }
.knoten .meta { font-size: 12.5px; color: var(--text-leise); white-space: nowrap; font-variant-numeric: tabular-nums; }
.knoten .aktion { width: 28px; height: 28px; }
.knoten:hover .aktion { opacity: 1; }
.baum-anzahl { font-size: 12.5px; color: var(--text-leise); }

/* ---- Ablage-Protokoll ------------------------------------------------- */
.protokoll {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 35; width: min(440px, 100vw);
  display: flex; flex-direction: column; background: var(--flaeche); border-left: 1px solid var(--rand); box-shadow: var(--schatten-stark);
}
.protokoll-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--rand); }
.protokoll-status { font-size: 12.5px; color: var(--text-leise); margin-top: 2px; }
.protokoll-status .fehler { color: var(--gefahr); }
.protokoll-zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--rand); }
.protokoll-zahlen div { font-size: 12px; color: var(--text-leise); }
.protokoll-zahlen strong { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.protokoll-liste { list-style: none; margin: 0; padding: 6px 0; overflow: auto; flex: 1; }
.protokoll-liste li { padding: 10px 16px; border-bottom: 1px solid var(--rand); font-size: 13.5px; }
.p-kopf { display: flex; justify-content: space-between; gap: 8px; color: var(--text-leise); font-size: 12px; }
.p-ziel { margin-top: 3px; word-break: break-word; }
.p-ziel .von { color: var(--text-leise); text-decoration: line-through; }
.p-ziel .nach { font-weight: 500; }
.p-grund { margin-top: 3px; color: var(--text-leise); font-size: 12.5px; }
.p-fuss { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-leise); }
li.p-fehler .p-ziel { color: var(--gefahr); }
li.p-rueck .p-ziel .nach { text-decoration: line-through; font-weight: 400; color: var(--text-leise); }
.p-status { font-size: 11.5px; padding: 1px 7px; border-radius: 9px; background: var(--hover); }
