/* WebTAK Admin – dark design like ATAK (always dark, square, ATAK blue) */
:root, :root:root {
  color-scheme: dark;
  --bg: #11151b; --fg: #f2f4f7; --card: #1d2128; --mut: #9aa3ad; --acc: #33b5e5; --acc-fg: #04121a;
  --bd: #3a404a; --ok: #3ddc4b; --warn: #f6c344; --err: #ff6b6b; --shadow: 0 10px 30px rgba(0, 0, 0, .6);
  --bar: #0b0e12; --side: #161a20; --hover: #262b33;
}
body { font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); }
.card { border-radius: 4px; }
input, select, button { border-radius: 3px; }
input:not([type=checkbox]), select { background: #14181e; border-color: #454c57; }
input:focus, select:focus { outline: none; border-color: var(--acc); }
button { background: #2a2f38; border-color: #454c57; }
button:hover:not(:disabled) { background: #333a45; }
button.pri { background: #1f6f9a; border-color: #2c8fc4; color: #fff; }
button.pri:hover:not(:disabled) { background: #2681b3; }
button.danger.pri { background: #b3261e; border-color: #d33; }
h2 { font-weight: 500; letter-spacing: .2px; }
h3 { color: var(--acc); font-weight: 500; }

/* Login */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(ellipse at top, #1c2530 0%, var(--bg) 60%); }
.auth form { width: 100%; max-width: 380px; padding: 24px; border-top: 3px solid var(--acc); }
.auth h1 { margin-bottom: 8px; font-size: 18px; font-weight: 500; }
.brand { text-align: center; margin-bottom: 22px; }
.brand img { width: 240px; max-width: 70vw; height: auto; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .7)); }
.brand-name { font-size: 34px; font-weight: 700; letter-spacing: 1px; margin-top: 8px; }
.brand-sub { color: var(--mut); text-transform: uppercase; letter-spacing: 4px; font-size: 12px; margin-top: 6px; }
.auth-foot { color: var(--mut); font-size: 12px; margin-top: 18px; }
.wide { width: 100%; margin-top: 16px; padding: 11px; }

/* Header and sidebar */
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center; height: 54px;
  padding: 0 12px; background: var(--bar); border-bottom: 1px solid var(--bd); }
.top .logo { height: 40px; width: auto; }
.top h1 { font-size: 19px; font-weight: 600; flex: 1; letter-spacing: .5px; white-space: nowrap; }
.top h1 span { color: var(--acc); font-weight: 400; }
.top .topr { flex-wrap: nowrap; }
.top #summary { color: var(--mut); white-space: nowrap; }
.navtoggle { display: none; font-size: 18px; padding: 4px 10px; }
.shell { display: flex; min-height: calc(100vh - 54px); }
.side { width: 250px; flex: none; background: var(--side); border-right: 1px solid var(--bd); padding: 8px 0;
  position: sticky; top: 54px; height: calc(100vh - 54px); overflow-y: auto; }
.side-h { color: var(--mut); font-size: 11px; text-transform: uppercase; letter-spacing: 2px; padding: 14px 16px 6px; }
.side a { display: flex; align-items: center; gap: 12px; padding: 11px 16px; color: var(--fg); text-decoration: none;
  border-left: 3px solid transparent; font-size: 14px; }
.side a:hover { background: var(--hover); }
.side a.on { background: #23303d; border-left-color: var(--acc); color: #fff; }
.side .ic { width: 22px; text-align: center; font-size: 16px; filter: grayscale(.3); }
.side .nb { margin-left: auto; background: var(--warn); color: #111; border: 0; }
.side .nb.live { background: var(--ok); }
.side .nb:empty { display: none; }
.wrap { flex: 1; min-width: 0; max-width: 1400px; margin: 0; padding: 16px; }
@media (max-width: 900px) {
  .navtoggle { display: inline-block; }
  .top #summary { display: none; }
  .side { position: fixed; left: 0; top: 54px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.navopen .side { transform: none; }
}
.between { justify-content: space-between; }
.actions-end { align-self: flex-end; }
.filter { width: 200px; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
table.streams { width: 100%; border-collapse: collapse; font-size: 14px; }
.streams th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mut); padding: 8px; border-bottom: 1px solid var(--bd); white-space: nowrap; }
.streams td { padding: 10px 8px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
.streams tr:last-child td { border-bottom: 0; }
.streams .num { font-variant-numeric: tabular-nums; text-align: right; }
.streams .name b { display: block; }
.streams .name code { color: var(--mut); }
.link { display: flex; gap: 4px; min-width: 200px; }
.link input { font-size: 12px; padding: 5px 8px; font-family: ui-monospace, monospace; }
.btns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 220px; }

@media (max-width: 900px) {
  .streams thead { display: none; }
  .streams tr { display: block; border: 1px solid var(--bd); border-radius: 10px; padding: 8px; margin-bottom: 10px; }
  .streams td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 4px; }
  .streams td::before { content: attr(data-label); color: var(--mut); font-size: 12px; }
  .streams .num { text-align: left; }
  .link, .btns { min-width: 0; }
  .btns { justify-content: flex-start; }
  .filter { width: 100%; }
}

.modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); margin: 0; }
.modal-box h3 { font-size: 15px; margin: 18px 0 4px; }
.qr { display: block; width: 100%; max-width: 300px; margin: 8px auto; background: #fff; border-radius: 8px; }
.links dt { font-size: 12px; color: var(--mut); margin-top: 8px; }
.links dd { margin: 2px 0 0; display: flex; gap: 4px; }
.links input { font-size: 12px; font-family: ui-monospace, monospace; }

/* Freely movable video windows */
.win { position: fixed; z-index: 500; width: 480px; height: 400px; min-width: 220px; min-height: 160px;
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--bd); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; resize: both; }
.win.max { inset: 8px !important; width: auto !important; height: auto !important; resize: none; }
.win.min { height: auto !important; resize: none; }
.win.min .win-body { display: none; }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: move; user-select: none; touch-action: none;
  border-bottom: 1px solid var(--bd); font-size: 13px; }
.win-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-bar button { padding: 2px 8px; font-size: 13px; line-height: 1.4; }
.win-body { position: relative; flex: 1; background: #000; display: flex; align-items: center; justify-content: center; min-height: 0; }
.win-body img { width: 100%; height: 100%; object-fit: cover; } /* always fill edge to edge */
.win-body:fullscreen img { object-fit: contain; }              /* fullscreen: show the whole image */
.win-info { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 12px; text-shadow: 0 1px 2px #000; }
.win-off { position: absolute; color: #bbb; font-size: 14px; }
input.rot { width: 76px; padding: 5px 6px; font-size: 13px; text-align: right; }
.deg { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.win-align { padding: 8px; border-bottom: 1px solid var(--bd); display: grid; gap: 6px; font-size: 13px; }
.win-align .row { gap: 6px; }
.win-align select { width: auto; padding: 4px 8px; font-size: 13px; }
.win-align input[type=range] { padding: 0; }
.win-bar button.pri { color: var(--acc-fg); }
.appqr { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.appqr.off .qr-small { opacity: .3; }
.qr-small { width: 140px; height: 140px; background: #fff; border-radius: 8px; flex: 0 0 auto; }
select.rot-size { width: auto; padding: 5px 8px; font-size: 13px; }
.badge.ready { color: var(--acc); }
button.golive { color: var(--ok); border-color: var(--ok); font-weight: 600; }
#toasts { position: fixed; right: 16px; top: 70px; z-index: 2000; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--card); border: 1px solid var(--bd); border-left: 5px solid var(--acc); border-radius: 10px;
  padding: 10px 12px; box-shadow: var(--shadow); display: grid; gap: 8px; animation: toastIn .2s ease-out; }
.toast.camera, .toast.live { border-left-color: var(--ok); }
.toast.stop { border-left-color: var(--mut); }
.toast-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* eingeklappte Nebenbereiche */
details.fold > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::before { content: '▸'; color: var(--mut); }
details.fold[open] > summary::before { content: '▾'; }
details.fold[open] > summary { margin-bottom: 12px; }
/* Video streams in the TAK server */
.takvideo { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 8px 0 4px; }
.sm-select, .sm-input { width: auto; padding: 4px 6px; font-size: 13px; }
.sm-input { width: 90px; }
.tak-path { font-size: 12px; padding: 5px 8px; font-family: ui-monospace, monospace; min-width: 120px; }
.tak-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; background: #777; }
.tak-dot.ok { background: #3ddc4b; }
.tak-dot.wait { background: #f6c344; }
.tak-dot.err { background: #e53935; }
.warn { color: #f6c344; }
.takvideo label.check { white-space: nowrap; margin: 0; }
.takvideo select.sm-select { width: auto; }
.takvideo input.sm-input { width: 90px; }
input.filter { width: 220px; }
@media (max-width: 900px) { input.filter { width: 100%; } }
/* TAK server: group tags */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #23303d; border: 1px solid #2c4256; white-space: nowrap; }
.tag.off { opacity: .5; }
.secret { font-family: ui-monospace, monospace; }
/* Links & QR-Codes */
.linkgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; }
.lcard { border: 1px solid var(--bd); border-radius: 4px; padding: 14px; background: #191d23; }
.lcard h3 { margin: 0 0 10px; }
.qr-mid { width: 180px; height: 180px; background: #fff; border-radius: 4px; display: block; margin: 0 auto 10px; padding: 4px; }
/* Helpers: only approvals and creating users */
body.helper .admin-only { display: none !important; }
body:not(.helper) .helper-only { display: none !important; }
.side a .admin-only, .side a .helper-only { display: inline; }
/* Notifications (🔔) */
.bell { position: relative; font-size: 17px; padding: 6px 12px; }
.nbadge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e53935; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; }
#notePanel { position: fixed; top: 58px; right: 12px; z-index: 2100; width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 80px); display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--bd); border-top: 3px solid var(--acc); border-radius: 4px; box-shadow: var(--shadow); }
.np-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--bd); }
.np-head b { flex: 1; font-size: 15px; }
#noteList { overflow-y: auto; flex: 1; }
.note { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--bd); }
.note.unread { background: #1d2f3e; box-shadow: inset 3px 0 0 var(--acc); cursor: pointer; }
.note.unread .note-head > span:first-child { font-weight: 600; }
.note-ic { font-size: 18px; width: 24px; text-align: center; }
.note-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.note-head > span:first-child { flex: 1; }
.note-del { background: none; border: 0; color: var(--mut); padding: 0 4px; font-size: 13px; line-height: 1; cursor: pointer; }
.note-del:hover:not(:disabled) { background: none; color: var(--fg); }
.np-foot { padding: 8px 12px; border-top: 1px solid var(--bd); display: grid; gap: 2px; }
.np-foot .check { font-size: 13px; margin: 2px 0; }

/* Push addresses (drone/OBS) */
table.kv { border-collapse: collapse; margin: 8px 0; width: 100%; }
table.kv th { text-align: left; font-weight: 500; padding: 4px 10px 4px 0; white-space: nowrap; vertical-align: top; }
table.kv td { padding: 4px 0; word-break: break-all; }

/* Notification popups for information only: compact, disappear by themselves */
.toast.info { cursor: pointer; padding: 8px 12px; transition: opacity .3s, transform .3s; }
.toast.info.gone { opacity: 0; transform: translateX(20px); }

/* version next to the name: shows whether the current page was loaded after an update */
.top h1 .ver { font-size: 11px; color: var(--mut); letter-spacing: 0; }
