/* Signage-Verwaltung - Weboberflaeche. Farben passend zur Einrichtungsseite von Signage OS. */
:root {
  color-scheme: dark;
  --ground: #161c23;
  --panel: #1f2731;
  --field: #18202a;
  --raise: #283240;
  --line: #323d4a;
  --text: #e7ecf1;
  --muted: #92a0ae;
  --accent: #4f8cff;
  --ok: #43c88a;
  --warn: #e9b04f;
  --bad: #ef6a6a;
  --sleep: #7f8b99;
  --r-s: 6px;
  --r-m: 10px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", "Noto Sans", Ubuntu, system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
a { color: #8db4ff; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }

/* ------------------------------------------------------------ Kopfzeile */
.bar {
  display: flex; align-items: center; gap: 2rem;
  padding: 0 1.5rem; height: 3.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--ground);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 650; font-size: 1rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: .85rem; height: .85rem; border-radius: 2px; background: var(--accent); flex: none; }
.tabs { display: flex; gap: .25rem; height: 100%; }
.tabs a {
  display: flex; align-items: center; padding: 0 .9rem; height: 100%;
  color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .85rem; }

main { max-width: 92rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ------------------------------------------------------------ Knoepfe + Felder */
button, .btn {
  font: inherit; font-size: .93rem; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  padding: .55rem 1rem; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--raise); color: var(--text);
  text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { border-color: #46546a; }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.quiet { background: transparent; border-color: transparent; color: var(--muted); padding-left: .5rem; padding-right: .5rem; }
button.quiet:hover { color: var(--text); background: var(--raise); }
button.danger { color: #ffb3b3; border-color: #5a3036; background: #2a2026; }
button.danger:hover { border-color: var(--bad); }
button:disabled { opacity: .55; cursor: default; }
svg.i { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.f { display: block; font-weight: 550; font-size: .9rem; margin-bottom: 1rem; }
.f small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; margin-top: .3rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .35rem;
  font: inherit; font-size: .95rem; font-weight: 400; color: var(--text);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: .55rem .7rem;
}
textarea { resize: vertical; min-height: 4.2rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--accent); }
input[type="checkbox"] { display: inline-block; width: auto; margin: 0 .45rem 0 0; accent-color: var(--accent); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------ Lagebild (Uebersicht) */
.lage { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.lage h1 { font-size: 1.9rem; line-height: 1.2; max-width: 40ch; }
.lage p { color: var(--muted); margin-top: .45rem; max-width: 70ch; }
.lage p b { color: var(--text); font-weight: 600; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 30; min-width: 17rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: .35rem; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.menu-list button { width: 100%; justify-content: flex-start; background: transparent; border-color: transparent; font-weight: 500; }
.menu-list button:hover { background: var(--raise); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: .3rem .2rem; }

/* ------------------------------------------------------------ Bildschirm-Wand */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 2rem 1.5rem; }
.tile { color: inherit; text-decoration: none; display: block; border-radius: var(--r-m); }
.tile:focus-visible { outline-offset: 6px; }

/* Ein Bildschirm: schwarzes Glas im Rahmen, darunter die Betriebs-LED */
.screen {
  position: relative; background: #2b333d; padding: 7px 7px 16px; border-radius: 9px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}
.glass { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 3px; overflow: hidden; }
.glass img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.glass .veil {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 1rem; color: #cfd6de; font-weight: 550; font-size: .95rem;
}
.led {
  position: absolute; right: 14px; bottom: 5px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--sleep);
}
.k-ok .led { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.k-warn .led { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.k-bad .led { background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.k-sleep .led { background: var(--sleep); }
.k-bad .glass img { filter: grayscale(1) brightness(.35); }
.k-bad .glass .veil { background: rgba(0, 0, 0, .25); }
.k-sleep .glass img { filter: brightness(.55); }
.k-sleep .glass .veil { align-items: flex-end; justify-content: flex-start; font-size: .82rem; font-weight: 500; padding: .6rem .8rem;
  background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0) 45%); color: #fff; }
.tile:hover .screen { background: #333c48; }

.tile-text { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: .75rem; padding: 0 .15rem; }
.tile-name { font-weight: 600; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-state { font-size: .88rem; white-space: nowrap; }
.tile-sub { color: var(--muted); font-size: .85rem; padding: 0 .15rem; margin-top: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-sleep { color: #b3bdc8; }
.busy-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); margin-right: .35rem; animation: pulse 1.2s ease-in-out infinite; }

.foot-note { margin-top: 3rem; color: var(--muted); font-size: .85rem; max-width: 70ch; }

/* ------------------------------------------------------------ Geraet (Detail) */
.back { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 1rem; }
.back:hover { color: var(--text); }
.dev-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.dev-head h1 { font-size: 1.75rem; }
.dev-head .where { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 550; padding: .2rem .7rem; border-radius: 99px; background: var(--raise); }
.pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }

.dev { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 1fr); gap: 2rem; align-items: start; }
.dev .screen { padding: 9px 9px 20px; border-radius: 12px; }
.dev .led { right: 18px; bottom: 7px; }
.shot-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .7rem; color: var(--muted); font-size: .88rem; flex-wrap: wrap; }
.glass.zoom { cursor: zoom-in; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); padding: 1.25rem 1.35rem; }
.panel + .panel { margin-top: 1.25rem; }
.panel h2 { font-size: 1.05rem; margin-bottom: .9rem; }
.panel .hint { color: var(--muted); font-size: .85rem; margin-top: -.5rem; margin-bottom: 1rem; }

.actions { display: grid; gap: .5rem; }
.act {
  display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; text-align: left;
  justify-content: stretch; align-items: center; padding: .7rem .85rem; white-space: normal;
  background: var(--field);
}
.act svg.i { grid-row: span 2; width: 1.25rem; height: 1.25rem; color: var(--muted); }
.act b { font-weight: 600; }
.act span { color: var(--muted); font-size: .83rem; font-weight: 400; }
.act.is-busy { border-color: var(--accent); }
.act.is-busy svg.i { color: var(--accent); animation: spin 1.4s linear infinite; }
.act.risky b { color: #ffc9c9; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.code { font-family: Consolas, "DejaVu Sans Mono", monospace; font-size: .86rem; }

.lower { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 1fr); gap: 2rem; margin-top: 2rem; align-items: start; }

/* ------------------------------------------------------------ Verlauf */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 4.2rem .7rem 1fr; gap: .2rem .7rem; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .92rem; align-items: baseline; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); }
.events .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--sleep); align-self: center; }
.events .who { color: var(--muted); text-decoration: none; }
.events .who:hover { color: var(--text); text-decoration: underline; }
.e-online .dot, .e-cmd .dot { background: var(--ok); }
.e-offline .dot, .e-crash .dot { background: var(--bad); }
.e-warn .dot, .e-auto .dot { background: var(--warn); }
.e-queued .dot, .e-reboot .dot { background: var(--accent); }
.day { font-size: .9rem; color: var(--muted); font-weight: 600; margin: 1.6rem 0 .3rem; }
.day:first-child { margin-top: 0; }
.log-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.log-head h1 { font-size: 1.75rem; }
.log-head select { width: auto; min-width: 14rem; }
.log { max-width: 52rem; }
.log .events li { grid-template-columns: 4.2rem .7rem 12rem 1fr; }

/* ------------------------------------------------------------ Web-Displays */
.web-list { list-style: none; margin: 0 0 2rem; padding: 0; max-width: 52rem; }
.web-list li { display: flex; align-items: center; gap: 1rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.web-list li:first-child { border-top: 0; }
.web-list .grow { flex: 1; min-width: 0; }
.web-list .sub { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.narrow { max-width: 36rem; }

/* ------------------------------------------------------------ Dialog, Toast, Bildansicht */
dialog {
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); color: var(--text);
  padding: 1.5rem; width: min(28rem, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
dialog::backdrop { background: rgba(8, 11, 15, .7); }
dialog h2 { font-size: 1.2rem; margin-bottom: .6rem; }
dialog p { color: var(--muted); }
dialog .row { justify-content: flex-end; margin-top: 1.5rem; }
dialog.viewer { width: auto; max-width: calc(100vw - 2rem); padding: .5rem; background: #000; border-color: #000; }
dialog.viewer img { display: block; max-width: calc(100vw - 3rem); max-height: calc(100vh - 3rem); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0;
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: .7rem 1.1rem; z-index: 50; max-width: calc(100vw - 2rem); pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); }

.empty { border: 1px dashed var(--line); border-radius: var(--r-m); padding: 2.5rem 2rem; max-width: 46rem; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 1.15rem; margin-bottom: .5rem; }
.empty ol { margin: .8rem 0 0; padding-left: 1.2rem; }
.empty li { margin: .3rem 0; }
.muted { color: var(--muted); }
.err-text { color: var(--bad); font-size: .88rem; min-height: 1.3em; }

/* ------------------------------------------------------------ Anmeldung */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login form { width: min(22rem, 100%); }
.login .brand { margin-bottom: 2rem; font-size: 1.1rem; }
.login h1 { font-size: 1.5rem; margin-bottom: .35rem; }
.login p { color: var(--muted); margin-bottom: 1.5rem; }
.login button { width: 100%; margin-top: .5rem; padding: .7rem; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 960px) {
  .dev, .lower { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { font-size: 14px; }
  .bar { gap: .75rem; padding: 0 .9rem; overflow-x: auto; }
  .brand span:last-child { display: none; }
  .tabs a { padding: 0 .6rem; }
  .bar-right .stamp, #logout span { display: none; }
  main { padding: 1.25rem .9rem 3rem; }
  .lage h1 { font-size: 1.45rem; }
  .wall { grid-template-columns: 1fr; }
  .log .events li { grid-template-columns: 3.8rem .7rem 1fr; }
  .log .events li .who { grid-column: 3; }
  .log .events li .what { grid-column: 3; }
}

/* WLAN-Karte auf der Geräteseite */
.wifi-now { display: flex; gap: .6rem; align-items: center; margin: -.2rem 0 1.1rem; }
.wifi-now .dot { flex: none; width: .62rem; height: .62rem; border-radius: 50%; background: var(--sleep); }
.wifi-now .dot.ok { background: var(--ok); }
.wifi-now .dot.warn { background: var(--warn); }
.wifi-now .dot.bad { background: var(--bad); }
#d-wifi input[type="checkbox"] { width: auto; }
#d-wifi input:disabled { opacity: .5; }
