/* Komfortbot Cloud. Dunkle, ruhige Oberfläche im Stil einer gewöhnlichen
   Web-Anwendung - anders als die Wand, die auf Ablesbarkeit aus drei Metern
   ausgelegt ist. Hier wird gelesen, geklickt und getippt, also normale Größen
   und feste Abstände statt Viewport-abhängiger Sprünge. */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hi: #1c232c;
  --line: #262d36;
  --line-strong: #343c47;

  --ink: #e8edf3;
  --ink-soft: #9aa7b4;
  --ink-dim: #6b7885;

  --accent: #4aa8f0;
  --accent-deep: #1b4f7a;
  --green: #62c073;
  --amber: #e0a33c;
  --red: #e56b6b;

  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

/* ------------------------------------------------------------------ Bausteine */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.button:hover { background: #232b35; border-color: #3f4854; }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #06243d; font-weight: 600; }
.button.primary:hover { background: #5cb4f5; border-color: #5cb4f5; }
.button.ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.button.ghost:hover { background: var(--surface-hi); color: var(--ink); }
.button.danger { background: var(--red); border-color: var(--red); color: #2b0c0c; font-weight: 600; }
.button.block { width: 100%; }
.button[disabled] { opacity: 0.5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--ink-soft); }
.field input {
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--accent); }

.form-error {
  margin: 0 0 12px;
  padding: 9px 12px;
  background: rgba(229, 107, 107, 0.12);
  border: 1px solid rgba(229, 107, 107, 0.35);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 14px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-deep);
  color: #8fd0ff;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand strong { font-size: 15px; font-weight: 600; }
.brand small { display: block; color: var(--ink-dim); font-size: 12px; }

/* -------------------------------------------------------------- Anmeldeseite */

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.login-card .brand { margin-bottom: 22px; }
.login-card .button { width: 100%; }

/* ------------------------------------------------------------------- Kopfzeile */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.search { flex: 1; max-width: 460px; }
.search input {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { color: var(--ink-soft); font-size: 14px; }

/* --------------------------------------------------------------------- Aufbau */

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  align-items: start;
}
.sidebar { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 78px; }
.content { min-width: 0; position: relative; min-height: 60vh; }

/* --------------------------------------------------------------- Speicherbalken */

.storage, .recent {
  margin-top: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.storage h3, .recent h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.meter { height: 7px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.is-tight span { background: var(--amber); }
.meter.is-full span { background: var(--red); }
.storage p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.storage p strong { color: var(--ink); font-weight: 600; }
.storage .note { margin-top: 6px; font-size: 12px; color: var(--ink-dim); }

.recent ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.recent li { display: flex; flex-direction: column; font-size: 13px; min-width: 0; }
.recent a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent a:hover { color: var(--accent); text-decoration: underline; }
.recent small { color: var(--ink-dim); font-size: 12px; }
.recent .empty { color: var(--ink-dim); font-size: 13px; }

/* ------------------------------------------------------------------ Brotkrümel */

.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.breadcrumb button {
  background: none;
  border: 0;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
}
.breadcrumb button:hover { background: var(--surface-hi); color: var(--ink); }
.breadcrumb .sep { color: var(--ink-dim); }
.breadcrumb .current { color: var(--ink); font-weight: 600; padding: 4px 6px; }

/* ---------------------------------------------------------------------- Liste */

.listing { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 110px 150px auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-hi); }
.row.head {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: var(--bg);
}
.row.head:hover { background: var(--bg); }

.row .icon { display: grid; place-items: center; color: var(--ink-soft); }
.row .icon svg { width: 20px; height: 20px; }
.row.is-folder .icon { color: var(--accent); }

.row .name { min-width: 0; display: flex; align-items: center; gap: 8px; }
.row .name button, .row .name a {
  background: none; border: 0; padding: 0;
  color: var(--ink); text-align: left; cursor: pointer; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .name button:hover, .row .name a:hover { color: var(--accent); text-decoration: underline; }
.row .size, .row .date { color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.row .actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s ease; }
.row:hover .actions, .row:focus-within .actions { opacity: 1; }
.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: none;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-button:hover { background: var(--line); color: var(--ink); }
.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-button svg { width: 17px; height: 17px; }
.icon-button.danger:hover { color: var(--red); }

.empty-state { padding: 46px 20px; text-align: center; color: var(--ink-dim); }
.empty-state strong { display: block; color: var(--ink-soft); font-size: 16px; margin-bottom: 4px; }

/* ------------------------------------------------------------------ Ablegen */

.content.is-dragging .listing { outline: 2px dashed var(--accent); outline-offset: 3px; }
.dropzone-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(13, 17, 23, 0.82);
  border-radius: var(--radius-lg);
  color: var(--accent);
  font-size: 17px;
  font-weight: 600;
  pointer-events: none;
}

/* ------------------------------------------------------------------- Uploads */

.uploads {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(340px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}
.upload {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.upload .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.upload .top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload .top em { font-style: normal; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.upload .meter { margin: 8px 0 0; height: 5px; }
.upload.is-error { border-color: rgba(229, 107, 107, 0.5); }
.upload.is-error .top em { color: var(--red); }

/* -------------------------------------------------------------------- Meldung */

.toasts { position: fixed; left: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  max-width: 380px;
}
.toast.is-error { border-color: rgba(229, 107, 107, 0.5); color: var(--red); }

/* --------------------------------------------------------------------- Dialog */

.dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(4, 7, 11, 0.7); }
.dialog h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.dialog p { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .row { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .row .size, .row .date { display: none; }
  .row .actions { opacity: 1; }
  .search { max-width: none; }
}
