/* Pult: Seite fürs iPad (Anmeldung, Schreiben / Bedienen / Dateien) */
:root {
  --grund: #f4f5f2;
  --flaeche: #ffffff;
  --text: #1d2420;
  --leise: #5b665f;
  --linie: #d5dad4;
  --akzent: #1f7a5a;
  --akzent-text: #ffffff;
  --warn: #a4372a;
  --leiste: #1d2420;
  --leiste-text: #e8ece8;
  --leiste-aktiv: #2f3a34;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #151a17;
    --flaeche: #1e2521;
    --text: #e6ebe7;
    --leise: #9aa59e;
    --linie: #34403a;
    --akzent: #3fae84;
    --akzent-text: #0d1310;
    --warn: #e0786b;
    --leiste: #0d1110;
    --leiste-aktiv: #26302b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--grund);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; }
button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
}
button.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); font-weight: 600; }
button:disabled { opacity: 0.5; cursor: default; }

/* --- Anmeldung --- */
.anmeldung {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.anmeldung form {
  width: min(380px, 100%);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  padding: 28px 24px;
  display: grid;
  gap: 14px;
}
.anmeldung h1 { margin: 0; font-size: 1.35rem; display: flex; gap: 10px; align-items: center; }
.anmeldung h1 img { width: 32px; height: 32px; }
.anmeldung p.leise { margin: -6px 0 4px; color: var(--leise); font-size: 0.92rem; }
.anmeldung label { display: grid; gap: 4px; font-size: 0.92rem; color: var(--leise); }
.anmeldung input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--grund);
  color: var(--text);
}
.anmeldung button { min-height: 46px; }
.meldung { margin: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--warn); color: var(--warn); }

/* --- Pult --- */
.pult { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.leiste {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left));
  padding-top: max(4px, env(safe-area-inset-top));
  background: var(--leiste);
  color: var(--leiste-text);
}
.reiter { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.leiste button {
  background: transparent;
  border-color: transparent;
  color: var(--leiste-text);
  white-space: nowrap;
}
.reiter button[aria-selected="true"] { background: var(--leiste-aktiv); border-color: #46534c; font-weight: 600; }
.code {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--akzent);
  color: var(--akzent-text);
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
  letter-spacing: 0.04em;
}
.code:empty { display: none; }
.rechts { display: flex; gap: 4px; align-items: center; }
.rechts form { margin: 0; }

main { position: relative; flex: 1; min-height: 0; }
/* Ansichten liegen übereinander; verdeckte behalten ihre Größe (sonst verkleinert noVNC den Bildschirm auf 0) */
.ansicht { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.ansicht.sichtbar { visibility: visible; pointer-events: auto; }
.ansicht iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.hinweis {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
  background: var(--grund);
}
.hinweis div { max-width: 460px; display: grid; gap: 12px; justify-items: center; }
.hinweis h2 { margin: 0; font-size: 1.25rem; }
.hinweis p { margin: 0; color: var(--leise); }
[hidden] { display: none !important; }

.dateien { overflow: auto; padding: 20px max(16px, env(safe-area-inset-left)); }
.dateien .kopf { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; max-width: 900px; margin: 0 auto 14px; }
.dateien h2 { margin: 0; font-size: 1.25rem; }
.dateien .knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.dateien .stand { max-width: 900px; margin: 0 auto 10px; color: var(--leise); font-size: 0.92rem; min-height: 1.4em; }
.liste { max-width: 900px; margin: 0 auto; list-style: none; padding: 0; border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche); overflow: hidden; }
.liste li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--linie); }
.liste li:first-child { border-top: 0; }
.liste .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.liste .info { color: var(--leise); font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.liste a { color: var(--akzent); font-weight: 600; text-decoration: none; padding: 8px 4px; }
.liste .leer { color: var(--leise); justify-content: center; padding: 22px; }
.programm { max-width: 900px; margin: 24px auto 0; color: var(--leise); font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

@media (max-width: 560px) {
  .leiste .wenig { display: none; }
  .liste .info { display: none; }
}

/* --- Dokument, Öffnen und Speichern --- */
.dokument {
  max-width: 28vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--leiste-text);
  opacity: 0.8;
  font-size: 0.9rem;
  margin-right: 4px;
}
.dokument.geaendert::after { content: " •"; color: #f0b44c; opacity: 1; }
.leiste #speichern { border-color: #46534c; }
.liste .aktionen { display: flex; gap: 4px; align-items: center; }
.liste button.oeffnen { min-height: 36px; padding: 0 12px; }
dialog {
  border: 1px solid var(--linie);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--text);
  padding: 22px 22px 18px;
  width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h3 { margin: 0 0 12px; font-size: 1.15rem; }
dialog p { margin: 0 0 14px; color: var(--leise); }
dialog label { display: grid; gap: 6px; font-size: 0.92rem; color: var(--leise); }
dialog input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--grund);
  color: var(--text);
}
dialog .knoepfe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.hinweiszeile {
  position: fixed;
  left: 50%;
  top: calc(56px + env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--leiste);
  color: var(--leiste-text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  z-index: 10;
}
.hinweiszeile.fehler { background: var(--warn); color: #fff; }
@media (max-width: 760px) {
  .dokument { display: none; }
}
