:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: #d9dee8;
  --primary: #2454ff;
  --primary-dark: #193bc2;
  --danger: #c0362c;
  --ok: #117a43;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: #111827; color: #fff; }
.topbar a { color: #fff; margin-right: 14px; }
.brand { font-weight: 700; font-size: 18px; }
.container { max-width: 1180px; margin: 28px auto; padding: 0 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 4px 20px rgba(17, 24, 39, 0.06); }
.narrow { max-width: 480px; margin: 0 auto; }
.wide { max-width: 900px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
h1 { margin: 0 0 8px; font-size: 30px; }
h2 { margin-top: 0; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-weight: 650; margin-bottom: 14px; }
input, select, textarea { width: 100%; display: block; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 14px; padding: 14px; }
legend { font-weight: 700; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; margin: 0; }
.help { display: block; color: var(--muted); font-weight: 400; font-size: 13px; margin-top: 4px; }
button, .button { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 9px 12px; border-radius: 10px; font: inherit; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { text-decoration: none; border-color: #9aa6bd; }
.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.primary:hover { background: var(--primary-dark); }
.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.inline { display: inline; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full, .form-actions.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { background: #f0f2f7; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.actions { white-space: nowrap; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #eef2ff; color: #243b7a; font-size: 12px; font-weight: 700; margin: 1px; }
.ok { background: #e8f7ee; color: var(--ok); }
.muted-pill { background: #f2f4f7; color: #475467; }
.flash { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid var(--line); background: #fff; }
.flash.success { border-color: #9dd8b2; background: #ecfdf3; }
.flash.error { border-color: #e7aaa4; background: #fff0ef; }
code { display: inline-block; max-width: 320px; overflow: auto; padding: 4px 6px; background: #f2f4f7; border-radius: 6px; }
.player-card video { width: 100%; max-height: 72vh; background: #000; border-radius: 12px; }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .page-head { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
}
.notice { border: 1px solid #b7caef; background: #eef4ff; border-radius: 12px; padding: 12px 14px; margin: 12px 0 18px; }
.notice.warn { border-color: #efc36b; background: #fff8e8; }
.compact { margin: 8px 0 0 18px; padding: 0; }
.compact li { margin: 4px 0; }
td code, .notice code { max-width: 520px; white-space: nowrap; }
.offline { background: #fff1f0; color: #b42318; }
.card-head, .matrix-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.stream-card h2, .matrix-card h2 { margin-bottom: 4px; }
.matrix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.matrix-card { padding: 18px; position: relative; overflow: hidden; }
.matrix-card.online-card { border-color: #a6e7bc; }
.matrix-card.offline-card { border-color: #f2b8b5; }
.matrix-preview { height: 150px; border-radius: 12px; background: #111827; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; letter-spacing: 0.08em; margin: 14px 0; }
.matrix-card.offline-card .matrix-preview { background: #344054; color: #d0d5dd; }
.matrix-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0 0 14px; }
.matrix-meta div { min-width: 0; }
.matrix-meta dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.matrix-meta dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.matrix-actions { display: flex; flex-wrap: wrap; gap: 8px; white-space: normal; }
details { margin-top: 12px; }
details code { max-width: 100%; white-space: nowrap; }
@media (max-width: 760px) {
  .matrix-grid { grid-template-columns: 1fr; }
  .matrix-meta { grid-template-columns: 1fr; }
  .actions { white-space: normal; }
}

/* Operationele matrix met live players */
.matrix-page { margin-top: -12px; }
.compact-head { margin-bottom: 12px; }
.live-matrix {
  --matrix-cols: 2;
  display: grid;
  grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr));
  gap: 10px;
  height: calc(100vh - 178px);
  min-height: 460px;
}
.live-tile {
  min-width: 0;
  min-height: 0;
  background: #05070d;
  border: 1px solid #202736;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 28px rgba(17,24,39,.12);
}
.tile-header {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 10px;
  top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  pointer-events: none;
}
.tile-header .pill { text-shadow: none; opacity: .94; }
.tile-frame { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.player-embed-body { margin: 0; background: #000; overflow: hidden; width: 100vw; height: 100vh; }
.embed-video { width: 100vw; height: 100vh; object-fit: contain; background: #000; display: block; }
.embed-overlay {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 8px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: #fff;
  font-size: 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  pointer-events: none;
}
.embed-title { font-weight: 700; }
@media (max-width: 900px) {
  .live-matrix { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .live-tile { height: 58vh; }
}
.pending { background: #fff8e8; color: #92400e; }

/* Futurised dark operation style */
:root {
  --bg: #000000;
  --card: #071315;
  --text: #f3f7f7;
  --muted: #9fb3b6;
  --line: #f3f7f7;
  --primary: #f3f7f7;
  --primary-dark: #d9e3e5;
  --danger: #ff5b57;
  --ok: #3cff9c;
  --panel: #102f33;
  --panel2: #1a2224;
}
html, body { min-height: 100%; background: #000; color: var(--text); }
body { background: #000; }
a { color: #f3f7f7; }
a:hover { color: #fff; text-decoration: none; }
.topbar {
  background: #000;
  border-bottom: 2px solid #f3f7f7;
  color: #f3f7f7;
  min-height: 58px;
}
.topbar a { color: #f3f7f7; }
.brand, .matrix-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.brand-logo { width: 30px; height: 30px; object-fit: contain; display: inline-block; }
.container { max-width: 1280px; }
.card, .flash, .notice, fieldset, .table-wrap, .matrix-card, .live-tile {
  background: var(--card);
  border-color: rgba(243,247,247,.75);
  box-shadow: none;
}
input, select, textarea {
  background: #000;
  color: var(--text);
  border-color: rgba(243,247,247,.75);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f3f7f7; outline-offset: 1px; }
button, .button {
  background: #000;
  color: #f3f7f7;
  border: 2px solid #f3f7f7;
  font-weight: 700;
}
button:hover, .button:hover { background: #f3f7f7; color: #000; border-color: #f3f7f7; }
.primary { background: #f3f7f7; color: #000; border-color: #f3f7f7; }
.primary:hover { background: #000; color: #f3f7f7; }
.danger { background: #000; color: #ff716d; border-color: #ff716d; }
.danger:hover { background: #ff716d; color: #000; }
th { background: #071315; color: #f3f7f7; border-bottom-color: rgba(243,247,247,.75); }
td, th { border-bottom-color: rgba(243,247,247,.28); }
code { background: #000; color: #f3f7f7; border: 1px solid rgba(243,247,247,.35); }
.pill { background: #102f33; color: #f3f7f7; border: 1px solid rgba(243,247,247,.32); }
.ok { background: rgba(60,255,156,.12); color: #3cff9c; border-color: rgba(60,255,156,.75); }
.offline { background: rgba(255,91,87,.12); color: #ff716d; border-color: rgba(255,91,87,.65); }
.pending { background: rgba(255,210,80,.13); color: #ffd872; border-color: rgba(255,210,80,.55); }
.muted-pill { background: #111; color: #c9d5d7; }
.notice { background: #071315; }
.notice.warn { background: #1d1600; border-color: #ffd872; }
.player-card video { border: 2px solid rgba(243,247,247,.75); }

/* Fullscreen live matrix: only a title bar and stream/player tiles */
.matrix-shell-body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  margin: 0;
}
.matrix-titlebar {
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  background: #000;
  border-bottom: 3px solid #f3f7f7;
}
.matrix-brand {
  color: #f3f7f7;
  font-size: 18px;
  text-decoration: none;
}
.matrix-brand:hover { text-decoration: none; }
.matrix-only {
  width: 100vw;
  height: calc(100vh - 54px);
  padding: 0;
  margin: 0;
  background: #000;
  overflow: hidden;
}
.live-matrix-full {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  grid-auto-flow: row;
  gap: 0;
  align-items: stretch;
  justify-items: stretch;
}
.live-tile-clean {
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.tile-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
}
.player-embed-body.clean-embed {
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}
.clean-embed .embed-video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #000;
  display: block;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
@media (max-width: 900px) {
  .live-matrix-full { grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr)); height: 100%; }
  .live-matrix-full .live-tile { height: auto; }
}
/* Final operational matrix layout: exact columns, top-left, bordered screens. */
.matrix-only {
  width: 100vw;
  height: calc(100vh - 54px);
  padding: 10px;
  margin: 0;
  background: #000;
  overflow: hidden;
  box-sizing: border-box;
}
.live-matrix-full {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--matrix-rows), minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-rows: minmax(0, 1fr);
  gap: 10px;
  align-content: start;
  justify-content: start;
  align-items: stretch;
  justify-items: stretch;
}
.live-tile-screen {
  border: 3px solid #f3f7f7;
  border-radius: 0;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(243,247,247,.28);
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.matrix-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}
.live-tile-screen.matrix-test-fallback::before {
  content: "TESTBEELD";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f3f7f7;
  font: 800 clamp(24px, 5vw, 72px)/1 Arial, sans-serif;
  background: linear-gradient(135deg, #12373b 0 35%, #1d2325 35% 60%, #000 60% 100%);
}
@media (max-width: 900px) {
  .matrix-only { padding: 8px; }
  .live-matrix-full {
    grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr));
    grid-template-rows: repeat(var(--matrix-rows), minmax(0, 1fr));
    height: 100%;
  }
  .live-matrix-full .live-tile { height: auto; }
}

/* Matrix polish: exact configured columns, stable top-left placement, no centering. */
.matrix-shell-body {
  background: #000 !important;
}
.matrix-titlebar {
  height: 52px;
  min-height: 52px;
  border-bottom: 1px solid rgba(243,247,247,.22);
  background: linear-gradient(180deg, #071618 0%, #000 100%) !important;
}
.matrix-only {
  height: calc(100vh - 52px) !important;
  padding: 10px !important;
  background: #000 !important;
  overflow: hidden !important;
}
.live-matrix-full {
  grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr)) !important;
  grid-template-rows: repeat(var(--matrix-rows), minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  gap: 10px !important;
  align-content: start !important;
  justify-content: start !important;
  align-items: stretch !important;
  justify-items: stretch !important;
}
.live-tile-screen {
  border: 2px solid rgba(243,247,247,.92) !important;
  border-radius: 16px !important;
  background: #020607 !important;
  box-shadow: 0 0 0 1px rgba(18,55,59,.95), 0 10px 32px rgba(0,0,0,.55), inset 0 0 0 1px rgba(243,247,247,.10) !important;
  overflow: hidden !important;
  display: flex !important;
}
.matrix-video {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: cover !important;
  background: #000 !important;
  border-radius: 14px !important;
  display: block !important;
}
@media (max-width: 900px) {
  .live-matrix-full {
    grid-template-columns: repeat(var(--matrix-cols), minmax(0, 1fr)) !important;
    grid-template-rows: repeat(var(--matrix-rows), minmax(0, 1fr)) !important;
  }
}


/* Matrix aspect-ratio fix: tiles preserve video proportions and never crop. */
.matrix-only {
  --matrix-tile-w: 320px;
  --matrix-tile-h: 180px;
}
.live-matrix-full {
  grid-template-columns: repeat(var(--matrix-cols), var(--matrix-tile-w)) !important;
  grid-template-rows: repeat(var(--matrix-rows), var(--matrix-tile-h)) !important;
  grid-auto-rows: var(--matrix-tile-h) !important;
  width: 100% !important;
  height: 100% !important;
  align-content: start !important;
  justify-content: start !important;
  align-items: start !important;
  justify-items: start !important;
}
.live-tile-screen {
  width: var(--matrix-tile-w) !important;
  height: var(--matrix-tile-h) !important;
  box-sizing: border-box !important;
  display: block !important;
  padding: 0 !important;
}
.matrix-video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: 14px !important;
  background: #000 !important;
}

/* Matrix polish: balanced outer spacing, non-cropping video and clean screen frames. */
.matrix-only {
  padding: 14px !important;
  box-sizing: border-box !important;
}
.live-matrix-full {
  gap: 14px !important;
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box !important;
  align-content: start !important;
  justify-content: start !important;
}
.live-tile-screen {
  border: 2px solid rgba(243,247,247,.82) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  background: #000 !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 10px 28px rgba(0,0,0,.6) !important;
}
.matrix-video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  background: #000 !important;
  border-radius: 14px !important;
  display: block !important;
}
@media (max-width: 900px) {
  .matrix-only { padding: 10px !important; }
  .live-matrix-full { gap: 10px !important; }
}

/* Final matrix spacing fix: keep a visible right gutter equal to the left gutter. */
.matrix-only {
  padding: 14px 18px 14px 18px !important;
}
@media (max-width: 900px) {
  .matrix-only { padding: 10px 12px 10px 12px !important; }
}

/* Grouped stream administration */
.stream-group, .admin-stream-group { margin-top: 24px; }
.group-title { font-size: 1rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.group-title::after { content: ""; height: 1px; flex: 1; background: rgba(255,255,255,.12); }
.mini-toggle { min-width: 112px; margin: 2px 4px 2px 0; padding: 6px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.05); color: var(--muted); font-size: .78rem; font-weight: 800; }
.mini-toggle.is-on { color: #05170d; background: #a6e7bc; border-color: #a6e7bc; }
.access-tags { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }

/* RTMP key modal */
.modal-backdrop[hidden] { display: none !important; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
}
.modal-card {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: #050809;
  color: #f3f7f7;
  box-shadow: 0 30px 80px rgba(0,0,0,.75);
  padding: 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close { border: 0; background: transparent; color: #f3f7f7; font-size: 2rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 6px 0 14px; }
.copy-row input { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
body.modal-open { overflow: hidden; }
.button.small { padding: 6px 10px; font-size: .82rem; }

/* Matrix stream name overlay. Keep pointer-events disabled so native video controls remain usable. */
.live-tile-screen { position: relative !important; }
.matrix-name-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  max-width: 86%;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(0,0,0,.48);
  color: #fff;
  font-weight: 800;
  letter-spacing: .02em;
  text-shadow: 0 2px 8px rgba(0,0,0,.85);
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .9;
}
.live-tile-screen:hover .matrix-name-overlay,
.live-tile-screen:focus-within .matrix-name-overlay { opacity: .35; }
.matrix-video { object-fit: contain !important; }

/* Admin overview polish: full-width blocks, compact toggles and modal previews. */
.admin-wide {
  width: calc(100vw - 36px);
  margin-left: calc(50% - 50vw + 18px);
  margin-right: calc(50% - 50vw + 18px);
}
.admin-wide .table-wrap { width: 100%; }
.admin-wide table { min-width: 1180px; width: 100%; }
.source-cell { white-space: nowrap; }
.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 6px;
  align-items: center;
  max-width: 260px;
}
.toggle-grid .inline { display: block; }
.toggle-grid .mini-toggle { width: 100%; min-width: 0; margin: 0; padding: 7px 9px; }
.matrix-toggles { max-width: 300px; }
.admin-wide td.actions { min-width: 310px; }
.admin-wide td.actions .button,
.admin-wide td.actions button { margin-bottom: 6px; }
.frame-modal-card { width: min(1200px, calc(100vw - 28px)); height: min(820px, calc(100vh - 28px)); display: flex; flex-direction: column; padding: 16px; }
.modal-iframe { flex: 1; width: 100%; min-height: 0; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; background: #000; }
.embed-body { background: #000; margin: 0; min-height: 100vh; overflow: hidden; }
.embed-watch { height: 100vh; padding: 14px; display: flex; }
.embed-player-card { width: 100%; flex: 1; padding: 14px; display: flex; flex-direction: column; min-height: 0; }
.embed-player-title { font-size: 1rem; font-weight: 800; margin: 0 0 10px; color: #f3f7f7; }
.embed-player-card video { flex: 1; min-height: 0; max-height: none; object-fit: contain; }
.embed-player-card #status { margin-top: 8px; }

/* Matrix label belongs to the player chrome, not to the center of the video. */
.live-tile-screen { overflow: hidden; }
.matrix-name-overlay {
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  transform: none !important;
  max-width: none !important;
  width: 100% !important;
  border-radius: 0 !important;
  border-width: 0 0 1px 0 !important;
  padding: 7px 12px !important;
  background: linear-gradient(180deg, rgba(0,0,0,.82), rgba(0,0,0,.44)) !important;
  text-align: left;
  font-size: .92rem;
  opacity: .96 !important;
}
.live-tile-screen:hover .matrix-name-overlay,
.live-tile-screen:focus-within .matrix-name-overlay { opacity: .96 !important; }
.matrix-video { border-radius: 14px; }


/* Admin streams table final polish: full-width rows, checkbox matrix toggles and modal edit/view/debug. */
.admin-streams-page .page-head { padding-left: 0; padding-right: 0; }
.admin-stream-table-wrap { padding: 0; overflow-x: auto; }
.admin-stream-table { width: 100% !important; min-width: 1060px !important; border-collapse: separate; border-spacing: 0; table-layout: auto; }
.admin-stream-table th,
.admin-stream-table td { vertical-align: middle !important; padding: 12px 14px; }
.admin-stream-table thead th { white-space: nowrap; }
.admin-stream-table tbody tr { min-height: 58px; }
.admin-stream-table .name-cell { width: 26%; font-size: 1rem; }
.admin-stream-table .source-cell { width: 150px; white-space: nowrap; }
.admin-stream-table .check-cell { width: 92px; text-align: center; }
.admin-stream-table .status-cell { width: 115px; white-space: nowrap; }
.admin-stream-table .key-cell { width: 100px; text-align: center; white-space: nowrap; }
.admin-stream-table .action-cell { width: 430px; white-space: nowrap; display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.admin-stream-table .action-cell .inline { display: inline-flex; margin: 0; }
.admin-stream-table .action-cell .button,
.admin-stream-table .action-cell button,
.admin-stream-table .row-button { height: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; margin: 0 !important; padding: 0 12px; line-height: 1; }
.source-pill { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; }
.matrix-check-form { display: inline-flex; align-items: center; justify-content: center; margin: 0; }
.admin-check-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 26px; cursor: pointer; }
.admin-check-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.admin-check-toggle span { position: relative; width: 44px; height: 26px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); transition: background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.admin-check-toggle span::after { content: ''; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; border-radius: 50%; background: #8b969b; transition: transform .16s ease, background .16s ease; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.admin-check-toggle input:checked + span { background: rgba(166,231,188,.28); border-color: #a6e7bc; box-shadow: 0 0 0 3px rgba(166,231,188,.08); }
.admin-check-toggle input:checked + span::after { transform: translateX(18px); background: #a6e7bc; }
.admin-check-toggle:focus-within span { outline: 2px solid rgba(166,231,188,.55); outline-offset: 2px; }
.frame-modal-card { width: min(1280px, calc(100vw - 28px)); height: min(900px, calc(100vh - 28px)); }
@media (max-width: 900px) {
  .admin-stream-table { min-width: 920px !important; }
  .admin-stream-table .action-cell { width: 360px; }
}

/* Admin streams grouped compact table + dropdown menu refinements. */
.topbar nav { align-items: center; }
.nav-dropdown { position: relative; display: inline-flex; align-items: center; }
.nav-drop-button {
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.05);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
}
.nav-drop-button::after { content: " ▾"; color: var(--muted); }
.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  display: none;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  background: #050809;
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  z-index: 30;
}
.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu { display: grid; gap: 4px; }
.nav-menu a { display: block; padding: 8px 10px; border-radius: 10px; white-space: nowrap; }
.nav-menu a:hover { background: rgba(166,231,188,.12); text-decoration: none; }

.admin-streams-compact {
  width: min-content;
  max-width: calc(100vw - 36px);
  margin-left: auto !important;
  margin-right: auto !important;
}
.admin-streams-head { width: 100%; }
.admin-streams-stack { display: grid; gap: 16px; justify-items: center; }
.collapsible-stream-group {
  width: max-content;
  max-width: calc(100vw - 36px);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
  overflow: clip;
}
.collapsible-stream-group > summary { list-style: none; }
.collapsible-stream-group > summary::-webkit-details-marker { display: none; }
.group-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}
.group-caret::before { content: "▾"; color: var(--muted); display: inline-block; transition: transform .15s ease; }
.collapsible-stream-group:not([open]) .group-caret::before { transform: rotate(-90deg); }
.group-title-text { font-weight: 900; letter-spacing: .05em; text-transform: uppercase; color: #f3f7f7; }
.group-count { color: var(--muted); font-weight: 800; font-size: .85rem; }
.group-bulk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.22);
}
.group-bulk-label { color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; margin-left: 8px; }
.group-bulk-label:first-child { margin-left: 0; }
.group-bulk-form { display: inline-flex; margin: 0; }
.group-bulk-form .button { min-height: 30px; height: 30px; padding: 0 10px; }

.admin-stream-table-wrap { width: max-content !important; max-width: calc(100vw - 36px); overflow-x: auto; border-radius: 0 0 18px 18px; }
.admin-stream-table.compact-stream-table {
  width: auto !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
}
.admin-stream-table col.col-name { width: 240px; }
.admin-stream-table col.col-source { width: 145px; }
.admin-stream-table col.col-internal { width: 92px; }
.admin-stream-table col.col-external { width: 92px; }
.admin-stream-table col.col-status { width: 110px; }
.admin-stream-table col.col-key { width: 84px; }
.admin-stream-table col.col-actions { width: 388px; }
.admin-stream-table th,
.admin-stream-table td {
  border-bottom: 1px solid rgba(255,255,255,.10) !important;
  vertical-align: middle !important;
}
.admin-stream-table tr:last-child td { border-bottom: 0 !important; }
.admin-stream-table th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-stream-table .name-cell { width: auto !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-stream-table .source-cell,
.admin-stream-table .status-cell,
.admin-stream-table .key-cell,
.admin-stream-table .check-cell { width: auto !important; text-align: center; }
.admin-stream-table .source-cell { text-align: left; }
.admin-stream-table .check-cell { padding-top: 0 !important; padding-bottom: 0 !important; }
.admin-stream-table .matrix-check-form { height: 100%; min-height: 58px; display: flex !important; align-items: center !important; justify-content: center !important; }
.admin-stream-table .key-cell { text-align: center !important; }
.admin-stream-table .key-cell .row-button { width: 58px; }
.admin-stream-table .key-head { text-align: center; }
.admin-stream-table .action-cell {
  display: table-cell !important;
  width: auto !important;
  white-space: nowrap;
}
.action-row { display: inline-flex; flex-wrap: nowrap; gap: 6px; align-items: center; justify-content: flex-start; }
.action-row .inline { margin: 0; display: inline-flex; }
.action-row .button,
.action-row button,
.admin-stream-table .row-button {
  height: 34px !important;
  min-height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 12px !important;
  line-height: 1 !important;
}
.header-link { color: inherit; text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,.35); }
.header-link:hover { color: #a6e7bc; border-bottom-color: #a6e7bc; text-decoration: none; }

.embed-admin-body { background: #000; min-height: 100vh; margin: 0; }
.embed-admin-main { padding: 16px; }
.modal-form-card { margin: 0 !important; width: 100% !important; box-sizing: border-box; }
.modal-form-card h1 { margin-top: 0; }
@media (max-width: 900px) {
  .admin-streams-compact, .collapsible-stream-group, .admin-stream-table-wrap { width: calc(100vw - 20px) !important; max-width: calc(100vw - 20px); }
  .admin-stream-table col.col-actions { width: 360px; }
  .group-bulk-row { flex-wrap: wrap; }
}

/* Final admin/menu/access refinements */
.nav-dropdown.hover-dropdown { position: relative; padding: 10px 0; margin-top: -10px; margin-bottom: -10px; }
.nav-dropdown.hover-dropdown .nav-menu { top: 100%; margin-top: 0; min-width: 160px; }
.nav-dropdown.hover-dropdown:hover .nav-menu,
.nav-dropdown.hover-dropdown:focus-within .nav-menu { display: grid !important; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #ff716d; color: #000; font-size: 12px; font-weight: 900; }

.admin-streams-stack { align-items: center; }
.collapsible-stream-group { width: max-content !important; max-width: calc(100vw - 36px) !important; min-width: min(1060px, calc(100vw - 36px)); }
.collapsible-stream-group .group-summary { width: 100%; min-width: inherit; }
.collapsible-stream-group:not([open]) { min-width: min(1060px, calc(100vw - 36px)); }
.group-bulk-row { display: none !important; }
.matrix-toggle-head { text-align: center !important; vertical-align: middle !important; }
.group-toggle-icons { display: inline-flex; gap: 4px; justify-content: center; margin-top: 4px; }
.icon-button { width: 24px; height: 22px; min-height: 22px; padding: 0 !important; border-radius: 8px; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; opacity: .8; }
.icon-button:hover { opacity: 1; }
.admin-stream-table.compact-stream-table { border-collapse: collapse !important; }
.admin-stream-table th, .admin-stream-table td { vertical-align: middle !important; }
.admin-stream-table tr td { border-bottom: 1px solid rgba(243,247,247,.28) !important; }
.admin-stream-table .check-cell { text-align: center !important; vertical-align: middle !important; }
.admin-stream-table .matrix-check-form { min-height: 52px !important; display: flex !important; align-items: center !important; justify-content: center !important; }
.admin-stream-table .key-cell { text-align: center !important; }
.admin-stream-table .key-cell .row-button { margin: 0 auto !important; height: 34px; }
.admin-stream-table .action-cell { display: table-cell !important; text-align: left; vertical-align: middle !important; }
.admin-stream-table .action-row { display: inline-flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.admin-stream-table-wrap { width: max-content !important; max-width: calc(100vw - 36px) !important; }
.admin-stream-table { width: max-content !important; min-width: 0 !important; }
.admin-stream-table col.col-name { width: 240px !important; }
.admin-stream-table col.col-source { width: 118px !important; }
.admin-stream-table col.col-internal { width: 94px !important; }
.admin-stream-table col.col-external { width: 94px !important; }
.admin-stream-table col.col-status { width: 112px !important; }
.admin-stream-table col.col-key { width: 78px !important; }
.admin-stream-table col.col-actions { width: 410px !important; }

.stream-form-card.modal-form-card { max-width: 860px; margin: 0 auto; }
.stream-dynamic-form [hidden] { display: none !important; }
.access-table-wrap code { max-width: 190px; }
.access-table-wrap .copy-row input { min-width: 280px; }

@media (max-width: 980px) {
  .collapsible-stream-group, .admin-stream-table-wrap { width: calc(100vw - 20px) !important; max-width: calc(100vw - 20px) !important; }
}

/* Iframe source type */
.matrix-iframe,
.player-iframe,
.embed-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #050505;
  border-radius: inherit;
}
.live-tile-iframe {
  background: #050505;
}
.player-card .iframe-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  border: 1px solid rgba(243,247,247,.16);
  border-radius: 18px;
  overflow: hidden;
  background: #050505;
}
.embed-player-card .iframe-shell,
.embed-watch .iframe-shell {
  min-height: min(70vh, 720px);
}
.player-embed-body .embed-iframe {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

/* No chrome in operational matrix: full viewport for tiles only. */
.matrix-shell-body .matrix-only {
  height: 100vh !important;
  padding: 14px 18px !important;
}

/* Matrix density + dynamic columns polish */
.matrix-shell-body .matrix-only {
  padding: 6px 8px !important;
}
.live-matrix-full {
  gap: 3px !important;
  justify-content: start !important;
  align-content: start !important;
}
.live-tile-screen {
  border-width: 1px !important;
  border-radius: 12px !important;
}
.matrix-video,
.matrix-iframe {
  border-radius: 10px !important;
}
.external-black-body {
  min-height: 100vh;
  margin: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.external-black-logo {
  width: min(220px, 32vw);
  height: auto;
  opacity: .95;
}
.settings-check { align-items: center; }
.compact-access-table td,
.compact-access-table th { vertical-align: middle; }
.access-edit-table input[type="text"],
.access-edit-table input[type="email"],
.access-edit-table input:not([type]) {
  min-width: 120px;
}
.access-edit-table .copy-row input { min-width: 300px; }

/* Admin table side spacing and long-name wrapping refinement. */
.admin-streams-page.admin-streams-compact {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  padding-left: clamp(28px, 3.2vw, 58px);
  padding-right: clamp(28px, 3.2vw, 58px);
}
.admin-streams-page .admin-streams-head {
  max-width: none;
}
.admin-streams-stack {
  width: 100%;
  align-items: center;
}
.collapsible-stream-group {
  max-width: calc(100vw - clamp(56px, 6.4vw, 116px)) !important;
}
.admin-stream-table-wrap {
  max-width: calc(100vw - clamp(56px, 6.4vw, 116px)) !important;
}
.admin-stream-table col.col-name {
  width: clamp(260px, 24vw, 420px) !important;
}
.admin-stream-table .name-cell {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  line-height: 1.25 !important;
  vertical-align: middle !important;
}
.admin-stream-table .name-cell strong {
  display: block;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
.admin-stream-table td,
.admin-stream-table th {
  vertical-align: middle !important;
}
@media (max-width: 900px) {
  .admin-streams-page.admin-streams-compact {
    padding-left: 18px;
    padding-right: 18px;
  }
  .collapsible-stream-group,
  .admin-stream-table-wrap {
    max-width: calc(100vw - 36px) !important;
  }
}


/* Iframe matrix span sizing + muted autoplay build */
.live-tile-screen {
  grid-column: span var(--tile-col-span, 1) !important;
  grid-row: span var(--tile-row-span, 1) !important;
}
.live-tile-iframe .matrix-iframe {
  width: 100% !important;
  height: 100% !important;
}
.stream-dynamic-form [data-source-field="iframe"] select {
  width: 100%;
}

/* Admin table viewport fit: balanced side spacing, no horizontal scrollbars. */
.admin-streams-page.admin-streams-compact {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding-left: clamp(18px, 2.4vw, 42px) !important;
  padding-right: clamp(18px, 2.4vw, 42px) !important;
  box-sizing: border-box !important;
}
.admin-streams-page .admin-streams-head,
.admin-streams-page .page-head {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}
.admin-streams-stack {
  width: 100% !important;
  max-width: 100% !important;
  justify-items: stretch !important;
  align-items: stretch !important;
}
.collapsible-stream-group {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
.collapsible-stream-group .group-summary {
  min-width: 0 !important;
}
.admin-stream-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
.admin-stream-table,
.admin-stream-table.compact-stream-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  box-sizing: border-box !important;
}
.admin-stream-table col.col-name { width: 24% !important; }
.admin-stream-table col.col-source { width: 9% !important; }
.admin-stream-table col.col-internal { width: 7.5% !important; }
.admin-stream-table col.col-external { width: 7.5% !important; }
.admin-stream-table col.col-status { width: 9% !important; }
.admin-stream-table col.col-key { width: 7% !important; }
.admin-stream-table col.col-actions { width: 36% !important; }
.admin-stream-table th,
.admin-stream-table td {
  box-sizing: border-box !important;
  padding-left: clamp(8px, .75vw, 14px) !important;
  padding-right: clamp(8px, .75vw, 14px) !important;
  vertical-align: middle !important;
}
.admin-stream-table .name-cell,
.admin-stream-table .name-cell strong {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  hyphens: auto !important;
  line-height: 1.25 !important;
}
.admin-stream-table .source-cell,
.admin-stream-table .status-cell,
.admin-stream-table .key-cell,
.admin-stream-table .check-cell,
.admin-stream-table .action-cell {
  overflow-wrap: anywhere !important;
}
.admin-stream-table .action-cell {
  white-space: normal !important;
}
.admin-stream-table .action-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  max-width: 100% !important;
}
.admin-stream-table .action-row .button,
.admin-stream-table .action-row button,
.admin-stream-table .row-button {
  flex: 0 0 auto !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
}
@media (max-width: 1180px) {
  .admin-stream-table col.col-name { width: 22% !important; }
  .admin-stream-table col.col-source { width: 9% !important; }
  .admin-stream-table col.col-internal { width: 8% !important; }
  .admin-stream-table col.col-external { width: 8% !important; }
  .admin-stream-table col.col-status { width: 9% !important; }
  .admin-stream-table col.col-key { width: 7% !important; }
  .admin-stream-table col.col-actions { width: 37% !important; }
  .admin-stream-table th,
  .admin-stream-table td { padding-left: 7px !important; padding-right: 7px !important; }
  .admin-stream-table .action-row { gap: 5px !important; }
  .admin-stream-table .action-row .button,
  .admin-stream-table .action-row button,
  .admin-stream-table .row-button { padding-left: 8px !important; padding-right: 8px !important; }
}
@media (max-width: 860px) {
  .admin-streams-page.admin-streams-compact {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .admin-stream-table th,
  .admin-stream-table td { font-size: .82rem !important; padding-left: 5px !important; padding-right: 5px !important; }
  .admin-stream-table col.col-name { width: 24% !important; }
  .admin-stream-table col.col-source { width: 10% !important; }
  .admin-stream-table col.col-internal { width: 8% !important; }
  .admin-stream-table col.col-external { width: 8% !important; }
  .admin-stream-table col.col-status { width: 9% !important; }
  .admin-stream-table col.col-key { width: 7% !important; }
  .admin-stream-table col.col-actions { width: 34% !important; }
  .source-pill,
  .admin-stream-table .row-button,
  .admin-stream-table .action-row .button,
  .admin-stream-table .action-row button { min-height: 30px !important; height: 30px !important; padding-left: 6px !important; padding-right: 6px !important; }
}

/* Matrix iframe span fix: span values must change the actual rendered tile size. */
.live-matrix-full {
  grid-auto-flow: row dense !important;
}
.live-matrix-full .live-tile-screen {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  align-self: stretch !important;
  justify-self: stretch !important;
}
.live-matrix-full .live-tile-iframe {
  grid-column: span var(--tile-col-span, 1) !important;
  grid-row: span var(--tile-row-span, 1) !important;
}
.live-matrix-full .live-tile-iframe .matrix-iframe {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: block !important;
}

/* Final adjustments: admin table uses viewport with 20px gutters, access spacing, viewer-safe switches. */
.container:has(.admin-streams-page),
.container:has(.access-page) {
  max-width: none !important;
  width: 100% !important;
  margin: 20px 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.admin-streams-page.admin-streams-compact {
  width: calc(100vw - 40px) !important;
  max-width: calc(100vw - 40px) !important;
  margin-left: 20px !important;
  margin-right: 20px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.admin-streams-page .admin-streams-head { width: 100% !important; }
.admin-streams-stack { width: 100% !important; align-items: stretch !important; justify-items: stretch !important; }
.collapsible-stream-group,
.collapsible-stream-group:not([open]) {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
.admin-stream-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}
.admin-stream-table.compact-stream-table,
.admin-stream-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
.admin-stream-table col.col-name { width: 28% !important; }
.admin-stream-table col.col-source { width: 9% !important; }
.admin-stream-table col.col-internal { width: 7% !important; }
.admin-stream-table col.col-external { width: 7% !important; }
.admin-stream-table col.col-status { width: 8.5% !important; }
.admin-stream-table col.col-key { width: 6.5% !important; }
.admin-stream-table col.col-actions { width: 34% !important; }
.admin-stream-table th,
.admin-stream-table td { padding-left: 8px !important; padding-right: 8px !important; vertical-align: middle !important; }
.admin-stream-table .name-cell,
.admin-stream-table .name-cell strong {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  line-height: 1.25 !important;
}
.admin-stream-table .action-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: normal !important;
}
.admin-stream-table .action-cell { white-space: normal !important; }
@media (max-width: 980px) {
  .admin-streams-page.admin-streams-compact { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; margin-left: 12px !important; margin-right: 12px !important; }
  .admin-stream-table th, .admin-stream-table td { padding-left: 5px !important; padding-right: 5px !important; }
}
.access-page { width: calc(100vw - 40px); max-width: 1480px; margin: 0 auto; }
.access-overview-card { margin-bottom: 24px !important; }
.access-overview-card + .access-overview-card { margin-top: 24px !important; }
.access-table-wrap { overflow-x: auto; }
.compact-access-table .check-cell { text-align: center; vertical-align: middle; }
.compact-access-table .admin-check-toggle { margin: 0 auto; }
.compact-access-table td, .compact-access-table th { vertical-align: middle !important; }
.nav-dropdown.hover-dropdown .nav-menu { pointer-events: auto; }
.nav-dropdown.hover-dropdown::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }


/* Requested refinements: Bronnen/admin menu, tables, access, matrix labels. */
.topbar nav .nav-dropdown.hover-dropdown { padding-bottom: 14px; }
.topbar nav .nav-dropdown.hover-dropdown .nav-menu { top: calc(100% - 4px); }
.admin-streams-compact { width: calc(100vw - 40px) !important; max-width: calc(100vw - 40px) !important; }
.admin-streams-head { max-width: calc(100vw - 40px); margin-left: auto; margin-right: auto; }
.admin-streams-stack { width: 100%; align-items: center; }
.collapsible-stream-group { width: min(max-content, calc(100vw - 40px)) !important; max-width: calc(100vw - 40px) !important; min-width: min(1060px, calc(100vw - 40px)) !important; }
.collapsible-stream-group:not([open]) { width: min(1060px, calc(100vw - 40px)) !important; max-width: calc(100vw - 40px) !important; }
.admin-stream-table-wrap { max-width: calc(100vw - 40px) !important; overflow-x: hidden !important; }
.admin-stream-table { max-width: calc(100vw - 40px) !important; table-layout: fixed !important; }
.admin-stream-table .name-cell { white-space: normal !important; overflow-wrap: anywhere !important; word-break: break-word !important; line-height: 1.25; }
.admin-stream-table .name-cell strong { display: block; white-space: normal; overflow-wrap: anywhere; }
.admin-stream-table .action-row { flex-wrap: wrap !important; }
.admin-stream-table .action-row .button,
.admin-stream-table .action-row button { white-space: nowrap; }
.access-overview-card + .access-overview-card { margin-top: 28px; }
.access-expires-cell.is-hidden input { display: none !important; }
.access-expires-cell .access-unlimited-label { display: none; }
.access-expires-cell.is-hidden .access-unlimited-label { display: inline; }
.matrix-name-overlay { top: 8px; left: 8px; right: 8px; text-align: center; }
@media (max-width: 980px) {
  .admin-streams-compact,
  .collapsible-stream-group,
  .collapsible-stream-group:not([open]),
  .admin-stream-table-wrap { width: calc(100vw - 32px) !important; max-width: calc(100vw - 32px) !important; min-width: 0 !important; }
}

/* Organization multi-tenant refinements */
.org-switcher {
  min-width: 150px;
  max-width: 240px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: #050708;
  color: #f3f7f7;
  padding: 7px 12px;
  font-size: 13px;
}
fieldset.full {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 14px;
}
fieldset.full legend {
  padding: 0 8px;
  color: rgba(243,247,247,.82);
}

/* Organization sharing/menu refinements */
.topbar { gap: 18px; }
.topnav { flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 0; }
.nav-main { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.nav-account { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; flex: 0 0 auto; }
.nav-account .logout-form { display: inline-flex; margin: 0; }
.account-control, .org-switcher.account-control {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: #050708;
  color: #f3f7f7;
  padding: 8px 13px;
  font-weight: 800;
  line-height: 1;
}
.org-switcher.account-control { width: auto; min-width: 170px; margin: 0; }
.logout-form .account-control { cursor: pointer; }
.nav-dropdown.hover-dropdown { padding: 12px 0 16px; margin-top: -12px; margin-bottom: -16px; }
.nav-dropdown.hover-dropdown .nav-menu { top: calc(100% - 2px); margin-top: 0; }
.nav-dropdown.hover-dropdown::after { height: 18px; }
.matrix-toggle-head { vertical-align: top !important; padding-top: 10px !important; }
.matrix-toggle-head .header-link { display: block; line-height: 1.15; }
.group-toggle-icons { display: flex !important; justify-content: center !important; align-items: center; margin: 6px auto 0 !important; }
.share-target-list { display: grid; gap: 10px; }
.share-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 10px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.035); }
.share-org-text { display: grid; gap: 2px; min-width: 0; }
.share-org-text small { color: var(--muted); overflow-wrap: anywhere; }
.action-row .button { white-space: nowrap; }
@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .topnav { flex-direction: column; align-items: stretch; }
  .nav-account { justify-content: flex-start; margin-left: 0; flex-wrap: wrap; }
}

/* Admin/org UI polish patch */
.nav-badge[hidden] { display: none !important; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-streams-page { padding-left: 20px !important; padding-right: 20px !important; box-sizing: border-box; }
.admin-streams-stack { align-items: center !important; width: 100%; }
.collapsible-stream-group,
.collapsible-stream-group:not([open]),
.collapsible-stream-group[open] {
  width: min-content !important;
  min-width: min(1120px, calc(100vw - 40px)) !important;
  max-width: calc(100vw - 40px) !important;
}
.collapsible-stream-group .group-summary {
  width: 100% !important;
  box-sizing: border-box;
}
.admin-stream-table-wrap {
  width: auto !important;
  max-width: calc(100vw - 40px) !important;
  overflow-x: visible !important;
}
.admin-stream-table {
  width: auto !important;
  max-width: calc(100vw - 40px) !important;
  table-layout: fixed !important;
}
.admin-stream-table th { vertical-align: top !important; }
.admin-stream-table .status-cell,
.admin-stream-table th:nth-child(5) { text-align: center !important; }
.admin-stream-table .name-cell,
.admin-stream-table .name-cell strong {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  line-height: 1.25;
}
.admin-stream-table td,
.admin-stream-table th { vertical-align: middle !important; }
.admin-stream-table thead th { vertical-align: top !important; }
.admin-stream-table col.col-name { width: 300px !important; }
.admin-stream-table col.col-source { width: 115px !important; }
.admin-stream-table col.col-internal { width: 92px !important; }
.admin-stream-table col.col-external { width: 92px !important; }
.admin-stream-table col.col-status { width: 112px !important; }
.admin-stream-table col.col-key { width: 78px !important; }
.admin-stream-table col.col-actions { width: 430px !important; }
.admin-stream-table .action-row { flex-wrap: nowrap !important; }
.frame-modal-card {
  width: min(1180px, calc(100vw - 48px)) !important;
  max-height: calc(100vh - 48px) !important;
}
.frame-modal-card .modal-iframe {
  min-height: min(760px, calc(100vh - 140px)) !important;
}
.modal-card:not(.frame-modal-card) {
  width: fit-content;
  min-width: min(560px, calc(100vw - 48px));
  max-width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
}
@media (max-width: 1180px) {
  .admin-stream-table col.col-name { width: 250px !important; }
  .admin-stream-table col.col-actions { width: 390px !important; }
}

/* Final modal/table fit patch */
.container:has(.admin-streams-page) {
  max-width: none !important;
  width: 100% !important;
  margin: 20px 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.admin-streams-page.admin-streams-compact {
  width: calc(100vw - 40px) !important;
  max-width: calc(100vw - 40px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.admin-streams-page .admin-streams-head,
.admin-streams-page .page-head {
  width: 100% !important;
  max-width: calc(100vw - 40px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.admin-streams-stack {
  width: 100% !important;
  max-width: calc(100vw - 40px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  align-items: center !important;
  justify-items: center !important;
}
.collapsible-stream-group,
.collapsible-stream-group[open],
.collapsible-stream-group:not([open]) {
  width: min(100%, 1260px) !important;
  max-width: calc(100vw - 40px) !important;
  min-width: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.admin-stream-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.admin-stream-table,
.admin-stream-table.compact-stream-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
.admin-stream-table col.col-name { width: 30% !important; }
.admin-stream-table col.col-source { width: 9% !important; }
.admin-stream-table col.col-internal { width: 7% !important; }
.admin-stream-table col.col-external { width: 7% !important; }
.admin-stream-table col.col-status { width: 9% !important; }
.admin-stream-table col.col-key { width: 7% !important; }
.admin-stream-table col.col-actions { width: 31% !important; }
.admin-stream-table th,
.admin-stream-table td {
  vertical-align: middle !important;
  overflow: hidden !important;
}
.admin-stream-table .name-cell,
.admin-stream-table .name-cell strong {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  hyphens: auto !important;
}
.admin-stream-table .action-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 0 !important;
}
.admin-stream-table .action-row .button,
.admin-stream-table .action-row button,
.admin-stream-table .row-button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}
@media (min-width: 1500px) {
  .collapsible-stream-group,
  .collapsible-stream-group[open],
  .collapsible-stream-group:not([open]) { width: min(100%, 1480px) !important; }
  .admin-stream-table col.col-actions { width: 29% !important; }
  .admin-stream-table col.col-name { width: 32% !important; }
}
@media (max-width: 980px) {
  .admin-streams-page.admin-streams-compact,
  .admin-streams-stack,
  .admin-streams-page .admin-streams-head,
  .admin-streams-page .page-head,
  .collapsible-stream-group,
  .collapsible-stream-group[open],
  .collapsible-stream-group:not([open]) {
    max-width: calc(100vw - 24px) !important;
    width: calc(100vw - 24px) !important;
  }
  .admin-stream-table th,
  .admin-stream-table td { padding-left: 5px !important; padding-right: 5px !important; }
}

/* Modal sizing: content-aware defaults with explicit variants for view/debug/form. */
.modal-backdrop {
  padding: 18px !important;
  align-items: center !important;
  justify-content: center !important;
}
.modal-card {
  width: auto !important;
  min-width: min(520px, calc(100vw - 36px)) !important;
  max-width: min(980px, calc(100vw - 36px)) !important;
  max-height: calc(100vh - 36px) !important;
  overflow: auto !important;
  padding: 18px !important;
}
.frame-modal-card {
  display: flex !important;
  flex-direction: column !important;
  width: min(980px, calc(100vw - 36px)) !important;
  height: auto !important;
  max-height: calc(100vh - 36px) !important;
}
.frame-modal-card .modal-iframe {
  flex: 0 1 auto !important;
  width: 100% !important;
  height: min(640px, calc(100vh - 126px)) !important;
  min-height: min(420px, calc(100vh - 126px)) !important;
}
.frame-modal-card.modal-kind-view {
  width: min(1280px, calc(100vw - 36px)) !important;
}
.frame-modal-card.modal-kind-view .modal-iframe {
  height: min(720px, calc(100vh - 112px)) !important;
  min-height: min(520px, calc(100vh - 112px)) !important;
}
.frame-modal-card.modal-kind-debug {
  width: min(980px, calc(100vw - 36px)) !important;
}
.frame-modal-card.modal-kind-debug .modal-iframe {
  height: min(620px, calc(100vh - 112px)) !important;
  min-height: min(420px, calc(100vh - 112px)) !important;
}
.frame-modal-card.modal-kind-form,
.frame-modal-card.modal-kind-share {
  width: min(900px, calc(100vw - 36px)) !important;
}
.frame-modal-card.modal-kind-form .modal-iframe,
.frame-modal-card.modal-kind-share .modal-iframe {
  height: min(720px, calc(100vh - 112px)) !important;
  min-height: min(500px, calc(100vh - 112px)) !important;
}
@media (max-height: 660px) {
  .modal-card { padding: 14px !important; }
  .frame-modal-card .modal-iframe,
  .frame-modal-card.modal-kind-view .modal-iframe,
  .frame-modal-card.modal-kind-debug .modal-iframe,
  .frame-modal-card.modal-kind-form .modal-iframe,
  .frame-modal-card.modal-kind-share .modal-iframe {
    height: calc(100vh - 104px) !important;
    min-height: 280px !important;
  }
}

/* Admin sources table: keep row actions on one line. The name column is the flexible column. */
.admin-stream-table,
.admin-stream-table.compact-stream-table {
  table-layout: fixed !important;
  width: 100% !important;
  max-width: 100% !important;
}
.admin-stream-table col.col-source { width: 96px !important; }
.admin-stream-table col.col-internal { width: 76px !important; }
.admin-stream-table col.col-external { width: 76px !important; }
.admin-stream-table col.col-status { width: 86px !important; }
.admin-stream-table col.col-key { width: 64px !important; }
.admin-stream-table col.col-actions { width: 490px !important; }
.admin-stream-table col.col-name { width: auto !important; }
.admin-stream-table .action-cell {
  white-space: nowrap !important;
  overflow: visible !important;
}
.admin-stream-table .action-row {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 5px !important;
  white-space: nowrap !important;
  max-width: none !important;
}
.admin-stream-table .action-row .button,
.admin-stream-table .action-row button,
.admin-stream-table .row-button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  min-width: 0 !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
  font-size: .86rem !important;
}
.admin-stream-table .name-cell,
.admin-stream-table .name-cell strong {
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
@media (max-width: 1180px) {
  .admin-stream-table col.col-source { width: 86px !important; }
  .admin-stream-table col.col-internal { width: 70px !important; }
  .admin-stream-table col.col-external { width: 70px !important; }
  .admin-stream-table col.col-status { width: 78px !important; }
  .admin-stream-table col.col-key { width: 58px !important; }
  .admin-stream-table col.col-actions { width: 455px !important; }
  .admin-stream-table .action-row { gap: 4px !important; }
  .admin-stream-table .action-row .button,
  .admin-stream-table .action-row button,
  .admin-stream-table .row-button {
    padding-left: 6px !important;
    padding-right: 6px !important;
    font-size: .8rem !important;
  }
}
@media (max-width: 920px) {
  .admin-stream-table col.col-source { width: 78px !important; }
  .admin-stream-table col.col-internal { width: 62px !important; }
  .admin-stream-table col.col-external { width: 62px !important; }
  .admin-stream-table col.col-status { width: 72px !important; }
  .admin-stream-table col.col-key { width: 52px !important; }
  .admin-stream-table col.col-actions { width: 410px !important; }
  .admin-stream-table .action-row .button,
  .admin-stream-table .action-row button,
  .admin-stream-table .row-button {
    padding-left: 5px !important;
    padding-right: 5px !important;
    font-size: .74rem !important;
  }
}

/* Final requested admin fit patch: wider Key column, iframe edit modal, mobile/tablet source list. */
.admin-stream-table col.col-key { width: 78px !important; }
.admin-stream-table .key-cell,
.admin-stream-table .key-head {
  text-align: center !important;
  overflow: visible !important;
}
.admin-stream-table .key-cell .key-button {
  min-width: 52px !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
}
.admin-stream-table col.col-actions { width: 486px !important; }
.admin-stream-table col.col-name { width: auto !important; }

/* Iframe stream forms need extra vertical space because extra iframe options are shown. */
.frame-modal-card.modal-kind-form.modal-kind-iframe-form {
  width: min(980px, calc(100vw - 36px)) !important;
}
.frame-modal-card.modal-kind-form.modal-kind-iframe-form .modal-iframe {
  height: min(820px, calc(100vh - 92px)) !important;
  min-height: min(660px, calc(100vh - 92px)) !important;
}

@media (max-width: 1180px) {
  .admin-stream-table col.col-key { width: 72px !important; }
  .admin-stream-table col.col-actions { width: 450px !important; }
}

/* Tablet and phone: convert the sources table to responsive cards, while keeping actions on one horizontal line. */
@media (max-width: 760px) {
  .admin-streams-page.admin-streams-compact,
  .admin-streams-stack,
  .admin-streams-page .admin-streams-head,
  .admin-streams-page .page-head,
  .collapsible-stream-group,
  .collapsible-stream-group[open],
  .collapsible-stream-group:not([open]) {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    min-width: 0 !important;
  }
  .admin-streams-page .admin-streams-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    align-items: start !important;
  }
  .admin-streams-page .admin-streams-head .actions {
    justify-content: start !important;
  }
  .admin-stream-table-wrap {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .admin-stream-table,
  .admin-stream-table.compact-stream-table,
  .admin-stream-table thead,
  .admin-stream-table tbody,
  .admin-stream-table tr,
  .admin-stream-table th,
  .admin-stream-table td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .admin-stream-table colgroup,
  .admin-stream-table thead {
    display: none !important;
  }
  .admin-stream-table tbody {
    display: grid !important;
    gap: 12px !important;
  }
  .admin-stream-table tr {
    background: rgba(255,255,255,.045) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 16px !important;
    padding: 10px !important;
    overflow: hidden !important;
  }
  .admin-stream-table td {
    display: grid !important;
    grid-template-columns: minmax(86px, 32%) minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    padding: 8px 2px !important;
    overflow: visible !important;
    min-height: 38px !important;
    text-align: left !important;
  }
  .admin-stream-table td:last-child {
    border-bottom: 0 !important;
  }
  .admin-stream-table td::before {
    content: attr(data-label);
    color: rgba(243,247,247,.62);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  .admin-stream-table .name-cell strong {
    font-size: 1rem !important;
  }
  .admin-stream-table .check-cell .matrix-check-form,
  .admin-stream-table .check-cell .admin-check-toggle,
  .admin-stream-table .key-cell .key-button,
  .admin-stream-table .status-cell .pill {
    justify-self: start !important;
  }
  .admin-stream-table .action-cell {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    overflow: hidden !important;
  }
  .admin-stream-table .action-cell::before {
    display: none !important;
  }
  .admin-stream-table .action-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 4px !important;
    max-width: 100% !important;
    -webkit-overflow-scrolling: touch;
  }
  .admin-stream-table .action-row .button,
  .admin-stream-table .action-row button,
  .admin-stream-table .row-button {
    flex: 0 0 auto !important;
    min-height: 34px !important;
    font-size: .82rem !important;
    padding-left: 9px !important;
    padding-right: 9px !important;
  }
  .group-summary {
    border-radius: 14px !important;
  }
  .frame-modal-card,
  .frame-modal-card.modal-kind-form,
  .frame-modal-card.modal-kind-form.modal-kind-iframe-form,
  .frame-modal-card.modal-kind-view,
  .frame-modal-card.modal-kind-debug,
  .frame-modal-card.modal-kind-share {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    max-height: calc(100vh - 18px) !important;
  }
  .frame-modal-card .modal-iframe,
  .frame-modal-card.modal-kind-form .modal-iframe,
  .frame-modal-card.modal-kind-form.modal-kind-iframe-form .modal-iframe,
  .frame-modal-card.modal-kind-view .modal-iframe,
  .frame-modal-card.modal-kind-debug .modal-iframe,
  .frame-modal-card.modal-kind-share .modal-iframe {
    height: calc(100vh - 96px) !important;
    min-height: 360px !important;
  }
}

/* Matrix snapshots: timeline, snapshot button and annotation modal. */
.matrix-shell-body .matrix-only {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 18vw, 320px) !important;
  gap: 8px !important;
  align-items: stretch !important;
}
.matrix-shell-body .live-matrix-full {
  min-width: 0 !important;
  min-height: 0 !important;
}
.snapshot-timeline {
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(243,247,247,.14);
  border-radius: 12px;
  background: rgba(0,0,0,.72);
  display: flex;
  flex-direction: column;
}
.snapshot-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(243,247,247,.12);
  color: #f3f7f7;
  font-size: .88rem;
}
.snapshot-timeline-refresh,
.snapshot-delete,
.snapshot-tile-button,
.snapshot-close,
.snapshot-tools button {
  border: 1px solid rgba(243,247,247,.18);
  background: rgba(255,255,255,.06);
  color: #f3f7f7;
  border-radius: 999px;
  cursor: pointer;
}
.snapshot-timeline-refresh { width: 30px; height: 30px; }
.snapshot-timeline-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.snapshot-empty { color: #8d989b; font-size: .84rem; padding: 12px 4px; }
.snapshot-card {
  border: 1px solid rgba(243,247,247,.14);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.045);
}
.snapshot-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #000;
}
.snapshot-meta { padding: 8px 9px; display: grid; gap: 3px; font-size: .75rem; color: #b9c3c5; }
.snapshot-meta strong { color: #f3f7f7; font-size: .78rem; line-height: 1.2; }
.snapshot-delete { margin: 0 9px 9px; padding: 5px 10px; font-size: .74rem; }
.matrix-name-overlay {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 5px 7px !important;
}
.matrix-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snapshot-tile-button {
  flex: 0 0 auto;
  width: 28px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: rgba(0,0,0,.48);
}
.snapshot-tile-button:hover { background: rgba(255,255,255,.14); }
.snapshot-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.snapshot-modal[hidden] { display: none !important; }
.snapshot-modal-card {
  width: min(1180px, 96vw);
  max-height: 96vh;
  background: #07090a;
  border: 1px solid rgba(243,247,247,.18);
  border-radius: 18px;
  box-shadow: 0 26px 90px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.snapshot-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(243,247,247,.12);
}
.snapshot-close { width: 32px; height: 32px; font-size: 20px; }
.snapshot-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(243,247,247,.10);
}
.snapshot-tools button { padding: 7px 12px; }
.snapshot-tools button.active,
.snapshot-tools button.primary { background: #f3f7f7; color: #050708; }
.snapshot-canvas-wrap {
  padding: 12px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}
#snapshot-canvas {
  max-width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: 10px;
  border: 1px solid rgba(243,247,247,.14);
  touch-action: none;
}
.snapshot-help { padding: 0 14px 12px; color: #8d989b; font-size: .82rem; }
@media (max-width: 980px) {
  .matrix-shell-body .matrix-only {
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(0, 1fr) minmax(180px, 28vh) !important;
  }
  .snapshot-timeline { min-height: 180px; }
}

/* Snapshot panel repair: collapsible timeline + clickable snapshot icon. */
.matrix-shell-body .matrix-only.snapshot-panel-collapsed {
  grid-template-columns: minmax(0, 1fr) 44px !important;
}
.snapshot-timeline-toggle {
  border: 1px solid rgba(243,247,247,.18);
  background: rgba(255,255,255,.06);
  color: #f3f7f7;
  border-radius: 999px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(180deg);
  flex: 0 0 auto;
}
.snapshot-timeline.collapsed .snapshot-timeline-toggle {
  transform: rotate(0deg);
}
.snapshot-timeline.collapsed .snapshot-timeline-head {
  justify-content: center;
  padding-left: 6px;
  padding-right: 6px;
}
.snapshot-timeline.collapsed .snapshot-timeline-head strong,
.snapshot-timeline.collapsed .snapshot-timeline-refresh,
.snapshot-timeline.collapsed .snapshot-timeline-list {
  display: none !important;
}
/* The matrix title bar used to disable pointer events for video controls; keep video controls intact but allow the snapshot button. */
.matrix-name-overlay {
  pointer-events: auto !important;
}
.matrix-label-text {
  pointer-events: none !important;
}
.snapshot-tile-button {
  pointer-events: auto !important;
  position: relative;
  z-index: 8;
}
.snapshot-modal-card {
  color: #f3f7f7;
}

/* Snapshot restrictions and color/viewer refinements. */
.live-tile[data-can-snapshot="0"] .snapshot-tile-button,
.matrix-only[data-snapshot-enabled="0"] .snapshot-tile-button {
  display: none !important;
}
.snapshot-color-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(243,247,247,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: #f3f7f7;
  font-size: .86rem;
}
.snapshot-color-label input[type="color"] {
  width: 34px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.snapshot-card img {
  cursor: zoom-in;
}
.snapshot-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0,0,0,.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.snapshot-viewer-modal[hidden] { display: none !important; }
.snapshot-viewer-card {
  position: relative;
  width: min(1280px, 96vw);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.snapshot-viewer-card img {
  max-width: 100%;
  max-height: calc(96vh - 64px);
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(243,247,247,.18);
  background: #000;
  box-shadow: 0 26px 90px rgba(0,0,0,.7);
}
.snapshot-viewer-close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  background: rgba(0,0,0,.72) !important;
}
.snapshot-viewer-caption {
  color: #d8e2e3;
  font-size: .92rem;
  text-align: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
}


/* Snapshot external timeline + color picker refinements */
.snapshot-color-picker { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.snapshot-color-swatch { width: 34px; height: 34px; padding: 0 !important; border-radius: 999px !important; background: var(--swatch) !important; border: 2px solid rgba(243,247,247,.26) !important; box-shadow: inset 0 0 0 2px rgba(0,0,0,.20); }
.snapshot-color-swatch.active { outline: 2px solid #f3f7f7; outline-offset: 2px; }
.snapshot-color-label { min-height: 34px; box-sizing: border-box; font-weight: 800; }
.snapshot-color-label input[type="color"] { border-radius: 999px; overflow: hidden; }
.matrix-only[data-matrix-scope="external"] .snapshot-delete,
.matrix-only[data-matrix-scope="external"] .snapshot-tile-button { display: none !important; }
.matrix-only[data-matrix-scope="external"] .snapshot-card img { cursor: zoom-in; }
.live-tile-iframe[data-iframe-overlay-enabled="0"] .matrix-name-overlay { display: none !important; }


/* Snapshot panel polish: centered icons, corrected arrow direction, compact timeline actions. */
.snapshot-timeline-refresh,
.snapshot-timeline-toggle,
.snapshot-close,
.snapshot-delete,
.snapshot-tile-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
.snapshot-timeline-toggle {
  transform: rotate(0deg) !important; /* open panel: arrow points right */
  font-size: 22px !important;
  font-weight: 900 !important;
}
.snapshot-timeline.collapsed .snapshot-timeline-toggle {
  transform: rotate(180deg) !important; /* closed panel: arrow points left */
}
.snapshot-timeline-refresh {
  font-size: 17px !important;
  font-weight: 900 !important;
}
.snapshot-viewer-close,
.snapshot-close {
  line-height: 1 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
}
.snapshot-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px 9px;
}
.snapshot-card-body .snapshot-meta {
  padding: 0 !important;
  min-width: 0;
}
.snapshot-card-body .snapshot-delete {
  width: 32px !important;
  height: 32px !important;
  margin: 0 !important;
  font-size: 16px !important;
  color: #ffb4b4 !important;
  border-color: rgba(255,120,120,.28) !important;
  background: rgba(255,80,80,.10) !important;
  flex: 0 0 auto;
}
.snapshot-card-body .snapshot-delete:hover {
  background: rgba(255,80,80,.20) !important;
  border-color: rgba(255,160,160,.48) !important;
}
.matrix-only[data-matrix-scope="external"] .snapshot-card-body {
  grid-template-columns: minmax(0, 1fr);
}

/* PTZ matrix controls: compact overlay that keeps the camera image visible. */
.ptz-settings-fieldset { margin-top: 4px; }
.ptz-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ptz-settings-grid .full { grid-column: 1 / -1; }
.matrix-name-overlay { display: flex !important; align-items: center !important; gap: 6px !important; }
.matrix-name-overlay .matrix-label-text { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-tile-button,
.audio-sync-button,
.ptz-tile-button,
.lift-tile-button {
  flex: 0 0 auto;
  height: 24px;
  min-height: 24px;
  padding: 0 8px !important;
  border: 1px solid rgba(243,247,247,.24);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #f3f7f7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1;
  pointer-events: auto !important;
  cursor: pointer;
  position: relative;
  z-index: 9;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.audio-tile-button:hover,
.audio-sync-button:hover,
.ptz-tile-button:hover,
.lift-tile-button:hover { background: rgba(166,231,188,.18); border-color: rgba(166,231,188,.55); }
.audio-tile-button.active,
.audio-sync-button.active { background: rgba(166,231,188,.22); border-color: rgba(166,231,188,.72); color: #d8ffe4; }
.lift-tile-button { background: rgba(166,231,188,.18); border-color: rgba(166,231,188,.62); color: #d8ffe4; }
.audio-tile-volume {
  flex: 0 0 72px;
  width: 72px;
  max-width: 72px;
  accent-color: #a6e7bc;
  pointer-events: auto !important;
  position: relative;
  z-index: 9;
}
.audio-tile-volume[hidden],
.audio-volume-label[hidden],
.audio-sync-button[hidden] { display: none !important; }
.audio-volume-label {
  flex: 0 0 auto;
  min-width: 32px;
  color: rgba(243,247,247,.86);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .02em;
  pointer-events: none !important;
}
.matrix-name-overlay {
  justify-content: flex-start !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}
.audio-tile-volume {
  cursor: pointer;
}
.audio-tile-volume.inactive,
.audio-volume-label.inactive {
  opacity: .72;
}
.audio-sync-button[hidden] {
  display: none !important;
}
.live-tile.audio-sync-enabled .audio-tile-button.active {
  border-color: rgba(125,211,252,.76);
  color: #dff6ff;
}

.lift-tile-button.lift-busy,
.live-tile.lift-busy .lift-tile-button { background: rgba(255,159,67,.28); border-color: rgba(255,159,67,.82); color: #fff1db; }


.matrix-video::-webkit-media-controls-mute-button,
.matrix-video::-webkit-media-controls-volume-slider,
.matrix-video::-webkit-media-controls-volume-control-container {
  display: none !important;
}
.matrix-audio-companion {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  left: -9999px !important;
  top: auto !important;
}
.ptz-panel {
  position: absolute;
  z-index: 7;
  top: 44px;
  right: 8px;
  width: min(248px, calc(100% - 16px));
  max-height: calc(100% - 56px);
  overflow: auto;
  border: 1px solid rgba(243,247,247,.20);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(8,13,14,.92), rgba(0,0,0,.78));
  box-shadow: 0 18px 48px rgba(0,0,0,.55);
  padding: 10px;
  display: none;
  color: #f3f7f7;
  backdrop-filter: blur(8px);
}
.live-tile.ptz-panel-open .ptz-panel { display: grid; gap: 6px; }
.lift-panel {
  position: absolute;
  z-index: 7;
  top: 44px;
  right: 8px;
  width: min(220px, calc(100% - 16px));
  max-height: calc(100% - 56px);
  overflow: auto;
  border: 1px solid rgba(243,247,247,.20);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(8,13,14,.92), rgba(0,0,0,.78));
  box-shadow: 0 18px 48px rgba(0,0,0,.55);
  padding: 10px;
  display: none;
  color: #f3f7f7;
  backdrop-filter: blur(8px);
}
.live-tile.lift-panel-open .lift-panel { display: grid; gap: 8px; }
.lift-panel-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: .82rem; }
.lift-panel-head button,
.lift-control-grid button {
  border: 1px solid rgba(243,247,247,.22);
  background: rgba(255,255,255,.07);
  color: #f3f7f7;
  border-radius: 12px;
  min-height: 34px;
  font-weight: 900;
  cursor: pointer;
}
.lift-panel-head button { width: 28px; height: 28px; min-height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.lift-control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lift-status { min-width: 0; color: #a6e7bc; font-size: .72rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.live-tile.lift-busy .lift-status { color: #ffb45f; }
.lift-status.error { color: #ff9b97; }
.ptz-panel-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: .82rem; }
.ptz-panel-head button,
.ptz-control-grid button,
.ptz-zoom-row button {
  border: 1px solid rgba(243,247,247,.22);
  background: rgba(255,255,255,.07);
  color: #f3f7f7;
  border-radius: 12px;
  min-height: 34px;
  font-weight: 900;
  cursor: pointer;
}
.ptz-panel-head button { width: 28px; height: 28px; min-height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ptz-control-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ptz-control-grid button { min-width: 0; font-size: 16px; }
.ptz-control-grid .ptz-home-button { display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 0; }
.ptz-home-icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.ptz-zoom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ptz-range-stack { display: grid; gap: 0; margin-top: 0; }
.ptz-range { display: grid; grid-template-columns: 58px 34px minmax(0, 1fr); align-items: center; gap: 6px; min-height: 20px; margin: 0; padding: 0; line-height: 1.05; color: #c9d2d4; font-size: .74rem; font-weight: 800; }
.ptz-range input { width: 100%; min-width: 0; margin: 0; accent-color: #a6e7bc; }
.ptz-range-name { white-space: nowrap; }
.ptz-range-value { color: #a6e7bc; text-align: right; font-variant-numeric: tabular-nums; }
.ptz-status { min-width: 0; color: #a6e7bc; font-size: .72rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.ptz-status.error { color: #ff9b97; }
@media (max-width: 760px) {
  .ptz-settings-grid { grid-template-columns: 1fr; }
  .ptz-panel,
  .lift-panel { width: min(230px, calc(100% - 12px)); top: 42px; right: 6px; padding: 8px; }
  .ptz-control-grid { gap: 5px; }
  .ptz-control-grid button,
  .ptz-zoom-row button,
  .lift-control-grid button { min-height: 32px; }
  .ptz-range { grid-template-columns: 54px 32px minmax(0, 1fr); gap: 5px; }
}

/* Sensordata bronnen */
.live-tile-sensor {
  background: radial-gradient(circle at 20% 0%, #172554 0, #07111f 42%, #020617 100%);
  color: #e5eefb;
}
.sensor-tile-panel,
.sensor-player-full {
  width: 100%;
  height: 100%;
  padding: 44px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}
.sensor-player-full {
  min-height: 100vh;
  padding: 42px;
  background: radial-gradient(circle at 20% 0%, #172554 0, #07111f 42%, #020617 100%);
  color: #e5eefb;
}
.sensor-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: #f8fafc;
}
.sensor-card-head strong { font-size: 18px; }
.sensor-card-head span { color: #93a4b8; font-size: 13px; }
.sensor-latest {
  font-size: clamp(26px, 6vw, 54px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
}
.sensor-line-chart {
  width: 100%;
  height: 38%;
  min-height: 90px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(148, 163, 184, .24);
  overflow: visible;
}
.sensor-line-chart polyline {
  fill: none;
  stroke: #7dd3fc;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.sensor-threshold {
  stroke: #f97316;
  stroke-width: 2;
  stroke-dasharray: 7 6;
  vector-effect: non-scaling-stroke;
}
.sensor-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.sensor-values div {
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(15, 23, 42, .58);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.sensor-values span {
  display: block;
  color: #9ca3af;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sensor-values strong {
  display: block;
  color: #f8fafc;
  font-size: 15px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.sensor-gauge {
  position: relative;
  width: min(78%, 320px);
  aspect-ratio: 2 / 1;
  margin: 8px auto 0;
  overflow: hidden;
}
.sensor-gauge-arc {
  position: absolute;
  inset: 0;
  border-radius: 999px 999px 0 0;
  background: conic-gradient(from 270deg at 50% 100%, #22c55e 0deg, #f59e0b 90deg, #ef4444 180deg, transparent 180deg);
}
.sensor-gauge.reverse .sensor-gauge-arc {
  background: conic-gradient(from 270deg at 50% 100%, #ef4444 0deg, #f59e0b 90deg, #22c55e 180deg, transparent 180deg);
}
.sensor-gauge::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 76%;
  border-radius: 999px 999px 0 0;
  background: #07111f;
}
.sensor-gauge-needle {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 2;
  width: 3px;
  height: 86%;
  background: #f8fafc;
  transform-origin: bottom center;
  transition: transform 700ms cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
  box-shadow: 0 0 12px rgba(255,255,255,.6);
}
@media (prefers-reduced-motion: reduce) {
  .sensor-gauge-needle {
    transition: none;
  }
}
.sensor-gauge-center {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: -7px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: #f8fafc;
}
.sensor-gauge-scale {
  display: flex;
  justify-content: space-between;
  color: #93a4b8;
  font-size: 12px;
  margin: -4px auto 0;
  width: min(78%, 320px);
}
.sensor-empty {
  color: #cbd5e1;
  text-align: center;
  padding: 20px;
  border: 1px dashed rgba(148, 163, 184, .35);
  border-radius: 12px;
  background: rgba(15, 23, 42, .48);
}
.sensor-empty.error { color: #fecaca; border-color: rgba(248, 113, 113, .45); }
.sensor-field-table input[type="checkbox"] { width: auto; margin: 0; }
.sensor-field-table input[type="text"] { min-width: 140px; }
.sensor-field-table code { max-width: 280px; white-space: normal; overflow-wrap: anywhere; }

/* Sensordata lijngrafiek update: live, multi-series, grid, assen en klikbare legenda */
.live-tile-sensor .sensor-tile-panel,
.sensor-player-full {
  justify-content: stretch;
  gap: 8px;
}

.sensor-chart-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(70px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.sensor-chart-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sensor-line-chart {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 220px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .74);
  border: 1px solid rgba(148, 163, 184, .24);
  overflow: visible;
}

.live-tile .sensor-line-chart {
  min-height: 160px;
}

.sensor-chart-bg {
  fill: rgba(15, 23, 42, .72);
}

.sensor-grid-line {
  stroke: rgba(148, 163, 184, .22);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.sensor-axis-line {
  stroke: rgba(226, 232, 240, .55);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.sensor-line-series {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.sensor-point {
  stroke: rgba(2, 6, 23, .95);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  cursor: crosshair;
}

.sensor-point:hover {
  r: 6;
  stroke: #ffffff;
}

.sensor-x-label,
.sensor-y-label,
.sensor-threshold-label {
  fill: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  paint-order: stroke;
  stroke: rgba(2, 6, 23, .84);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.sensor-x-label {
  text-anchor: middle;
}

.sensor-y-label {
  text-anchor: end;
}

.sensor-threshold-label {
  text-anchor: end;
  fill: #fed7aa;
}

.sensor-y-axis-list {
  min-width: 72px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding: 2px 0;
}

.sensor-y-axis-item {
  border-left: 4px solid var(--series-color, #7dd3fc);
  border-radius: 9px;
  background: rgba(15, 23, 42, .52);
  border-top: 1px solid rgba(148, 163, 184, .18);
  border-right: 1px solid rgba(148, 163, 184, .18);
  border-bottom: 1px solid rgba(148, 163, 184, .18);
  padding: 7px 7px 7px 8px;
  color: #e5eefb;
}

.sensor-y-axis-item strong {
  display: block;
  max-width: 120px;
  margin-bottom: 5px;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sensor-y-axis-item span {
  display: block;
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.sensor-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.sensor-legend-item {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, .28);
  background: rgba(15, 23, 42, .64);
  color: #e5eefb;
  border-radius: 999px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}

.sensor-legend-item span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--series-color, #7dd3fc);
  box-shadow: 0 0 0 2px rgba(255,255,255,.08);
}

.sensor-legend-item.is-off {
  opacity: .55;
  text-decoration: line-through;
}

.sensor-legend-item.is-off span {
  background: transparent;
  border: 2px solid var(--series-color, #7dd3fc);
}

@media (max-width: 720px) {
  .sensor-chart-layout {
    grid-template-columns: 1fr;
  }
  .sensor-y-axis-list {
    order: 2;
    flex-direction: row;
    overflow-x: auto;
  }
  .sensor-chart-main {
    order: 1;
  }
}

/* Sensordata layout refinements: use the full matrix cell for the graph. */
.live-tile-sensor {
  padding: 0;
}
.live-tile-sensor .sensor-tile-panel {
  position: absolute;
  inset: 0;
  padding: 4px;
  gap: 0;
}
.live-tile-sensor .sensor-chart-layout,
.sensor-player-full .sensor-chart-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.live-tile-sensor .sensor-chart-main,
.sensor-player-full .sensor-chart-main {
  height: 100%;
  gap: 4px;
}
.live-tile-sensor .sensor-line-chart,
.sensor-player-full .sensor-line-chart {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border-radius: 8px;
}
.live-tile-sensor .sensor-legend {
  flex: 0 0 auto;
  max-height: 38px;
  overflow: auto;
  padding: 0 2px 2px;
}
.sensor-y-axis-list,
.sensor-y-label {
  display: none;
}
.sensor-field-table .compact-check {
  margin: 0;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.sensor-field-table .compact-check input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.sensor-field-table input[type="number"] {
  min-width: 100px;
}

/* Sensordata refinement: compact form, full graph cell and visible axis/tooltip. */
.sensor-settings-fieldset {
  min-width: 0;
}
.sensor-settings-fieldset > label:not(.full) {
  min-width: 0;
}
.sensor-field-table-wrap {
  min-width: 0;
  overflow-x: auto;
}
.sensor-field-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
}
.sensor-field-table th,
.sensor-field-table td {
  padding: 7px 8px;
  vertical-align: middle;
}
.sensor-field-table th:nth-child(1),
.sensor-field-table td:nth-child(1) { width: 58px; text-align: center; }
.sensor-field-table th:nth-child(2),
.sensor-field-table td:nth-child(2) { width: 28%; }
.sensor-field-table th:nth-child(3),
.sensor-field-table td:nth-child(3) { width: 24%; }
.sensor-field-table th:nth-child(4),
.sensor-field-table td:nth-child(4) { width: 78px; }
.sensor-field-table th:nth-child(5),
.sensor-field-table td:nth-child(5) { width: 92px; }
.sensor-field-table th:nth-child(6),
.sensor-field-table td:nth-child(6) { width: 86px; text-align: center; }
.sensor-field-table .sensor-table-toggle {
  margin: 0 auto;
  transform: scale(.82);
  transform-origin: center;
}
.sensor-field-table input.sensor-name-input {
  min-width: 0;
  width: 100%;
}
.sensor-field-table input.sensor-unit-input {
  min-width: 0;
  width: 58px;
  padding-left: 8px;
  padding-right: 8px;
}
.sensor-field-table input.sensor-threshold-input {
  min-width: 0;
  width: 82px;
  padding-left: 8px;
  padding-right: 8px;
}
.sensor-field-table .sensor-path-cell code {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.frame-modal-card.modal-kind-form .modal-iframe {
  width: 100%;
}
.live-tile-sensor .sensor-tile-panel {
  padding: 18px 6px 5px;
}
.live-tile-sensor .sensor-chart-layout,
.sensor-player-full .sensor-chart-layout {
  height: 100%;
}
.live-tile-sensor .sensor-chart-main,
.sensor-player-full .sensor-chart-main {
  position: relative;
}
.sensor-y-value-label {
  fill: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  text-anchor: start;
  paint-order: stroke;
  stroke: rgba(2, 6, 23, .88);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.sensor-line-chart .sensor-y-value-label {
  display: block;
}
.sensor-hover-tooltip {
  position: absolute;
  z-index: 12;
  max-width: min(260px, calc(100% - 24px));
  pointer-events: none;
  transform: translateY(-100%);
  border: 1px solid rgba(226, 232, 240, .28);
  border-radius: 10px;
  background: rgba(2, 6, 23, .94);
  color: #f8fafc;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 12px 26px rgba(0,0,0,.35);
}
.sensor-hover-tooltip[hidden] {
  display: none;
}
.sensor-point:hover {
  r: 6;
}
@media (max-width: 760px) {
  .sensor-field-table {
    min-width: 660px;
  }
}

/* Sensordata snelheidsmeter: alleen de meter tonen en actuele waarde in het midden. */
.sensor-gauge-only {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-tile-sensor .sensor-gauge-only {
  position: absolute;
  inset: 0;
  padding: 6px;
}

.live-tile-sensor .sensor-tile-panel:has(.sensor-gauge-only) {
  padding: 0;
}

.sensor-gauge-only .sensor-gauge {
  width: min(96%, 520px);
  max-height: 96%;
  margin: 0 auto;
}

.live-tile-sensor .sensor-gauge-only .sensor-gauge {
  width: min(98%, 100%);
}

.sensor-player-full .sensor-gauge-only .sensor-gauge {
  width: min(88vw, 760px);
}

.sensor-gauge-readout {
  position: absolute;
  z-index: 4;
  left: 17%;
  right: 17%;
  bottom: 10%;
  min-height: 32%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #f8fafc;
  pointer-events: none;
}

.sensor-gauge-readout strong {
  display: block;
  max-width: 100%;
  font-size: clamp(22px, 6vw, 52px);
  line-height: .95;
  font-weight: 850;
  letter-spacing: -.045em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
}

.sensor-gauge-readout span {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  color: #cbd5e1;
  font-size: clamp(10px, 1.8vw, 15px);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}

.live-tile-sensor .sensor-gauge-readout {
  left: 15%;
  right: 15%;
  bottom: 8%;
}

.live-tile-sensor .sensor-gauge-readout strong {
  font-size: clamp(18px, 5.4vw, 38px);
}

.live-tile-sensor .sensor-gauge-readout span {
  font-size: clamp(9px, 1.6vw, 12px);
}

/* Sensordata per-field display update: wider modal table, stable tooltips and clearer dense lines. */
.frame-modal-card.modal-kind-form,
.frame-modal-card.modal-kind-form .modal-iframe {
  width: min(1500px, calc(100vw - 20px));
}
.stream-form-card.modal-form-card:has(.sensor-settings-wide) {
  max-width: 1380px;
}
.sensor-field-table-config {
  min-width: 1180px;
}
.sensor-field-table-config th,
.sensor-field-table-config td {
  padding: 6px 7px;
}
.sensor-field-table-config th:nth-child(1),
.sensor-field-table-config td:nth-child(1) { width: 54px; }
.sensor-field-table-config th:nth-child(2),
.sensor-field-table-config td:nth-child(2) { width: 22%; }
.sensor-field-table-config th:nth-child(3),
.sensor-field-table-config td:nth-child(3) { width: 16%; }
.sensor-field-table-config th:nth-child(4),
.sensor-field-table-config td:nth-child(4) { width: 70px; }
.sensor-field-table-config th:nth-child(5),
.sensor-field-table-config td:nth-child(5) { width: 132px; }
.sensor-field-table-config th:nth-child(6),
.sensor-field-table-config td:nth-child(6) { width: 88px; }
.sensor-field-table-config th:nth-child(7),
.sensor-field-table-config td:nth-child(7) { width: 74px; text-align: center; }
.sensor-field-table-config th:nth-child(8),
.sensor-field-table-config td:nth-child(8),
.sensor-field-table-config th:nth-child(9),
.sensor-field-table-config td:nth-child(9) { width: 72px; }
.sensor-field-table-config th:nth-child(10),
.sensor-field-table-config td:nth-child(10) { width: 130px; }
.sensor-field-table-config select,
.sensor-field-table-config input {
  min-width: 0;
}
.sensor-field-table-config .sensor-field-view-select {
  width: 122px;
}
.sensor-field-table-config input.sensor-minmax-input,
.sensor-field-table-config input.sensor-threshold-input {
  width: 70px;
  padding-left: 7px;
  padding-right: 7px;
}
.sensor-field-table-config .sensor-color-select {
  width: 122px;
}
.sensor-line-series {
  stroke-width: 3.4;
  opacity: .98;
}
.sensor-point {
  stroke-width: 1.8;
  cursor: pointer;
}
.sensor-point:hover {
  r: 7;
  stroke: #fff;
}
.sensor-hover-tooltip {
  z-index: 50;
  opacity: 1 !important;
  transition: none !important;
}

/* Sensordata warning/gauge/form refinement. */
.frame-modal-card.modal-kind-form,
.frame-modal-card.modal-kind-form .modal-iframe {
  width: min(1760px, calc(100vw - 12px));
}
.stream-form-card.modal-form-card:has(.sensor-settings-wide) {
  max-width: 1680px;
}
.sensor-field-table-config {
  min-width: 1420px;
}
.sensor-field-table-config th,
.sensor-field-table-config td {
  padding: 7px 8px;
  vertical-align: middle;
}
.sensor-field-table-config th:nth-child(1),
.sensor-field-table-config td:nth-child(1) { width: 56px; text-align: center; }
.sensor-field-table-config th:nth-child(2),
.sensor-field-table-config td:nth-child(2) { width: 24%; }
.sensor-field-table-config th:nth-child(3),
.sensor-field-table-config td:nth-child(3) { width: 17%; }
.sensor-field-table-config th:nth-child(4),
.sensor-field-table-config td:nth-child(4) { width: 72px; }
.sensor-field-table-config th:nth-child(5),
.sensor-field-table-config td:nth-child(5) { width: 136px; }
.sensor-field-table-config th:nth-child(6),
.sensor-field-table-config td:nth-child(6) { width: 86px; }
.sensor-field-table-config th:nth-child(7),
.sensor-field-table-config td:nth-child(7) { width: 86px; text-align: center; }
.sensor-field-table-config th:nth-child(8),
.sensor-field-table-config td:nth-child(8),
.sensor-field-table-config th:nth-child(9),
.sensor-field-table-config td:nth-child(9) { width: 82px; }
.sensor-field-table-config th:nth-child(10),
.sensor-field-table-config td:nth-child(10) { width: 140px; }
.sensor-field-table-config .sensor-path-input {
  width: 100%;
  min-width: 0;
  font-family: inherit;
  color: #dbeafe;
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(148, 163, 184, .32);
  cursor: default;
}
.sensor-field-table-config .sensor-unit-input {
  width: 62px;
}
.sensor-field-table-config .sensor-threshold-input,
.sensor-field-table-config .sensor-minmax-input {
  width: 78px;
}
.sensor-field-table-config .sensor-field-view-select,
.sensor-field-table-config .sensor-color-select {
  width: 132px;
}
.sensor-field-table-config tr.is-disabled td:not(.sensor-check-cell):not(.sensor-path-cell) {
  opacity: .35;
}
.sensor-field-table-config tr.is-disabled .sensor-path-input {
  opacity: .62;
}
.sensor-field-table-config td[hidden],
.sensor-field-table-config th[hidden] {
  display: none !important;
}
.sensor-tile-title {
  position: absolute;
  z-index: 9;
  left: 7px;
  right: 7px;
  top: 5px;
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(2, 6, 23, .78), rgba(2, 6, 23, .42));
  color: #f8fafc;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
  pointer-events: none;
}
.sensor-tile-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sensor-warning-icon {
  flex: 0 0 auto;
  color: #facc15;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.75));
}
.live-tile-sensor .sensor-tile-panel {
  padding: 34px 6px 5px;
}
.sensor-player-full .sensor-tile-title {
  position: static;
  margin-bottom: 8px;
  font-size: 15px;
  background: rgba(15, 23, 42, .72);
}
.sensor-gauge-only {
  padding-top: 14px;
}
.live-tile-sensor .sensor-gauge-only {
  padding: 28px 6px 6px;
}
.live-tile-sensor .sensor-tile-panel:has(.sensor-gauge-only) {
  padding: 0;
}
.sensor-gauge-threshold {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 0;
  width: 3px;
  height: 92%;
  transform-origin: bottom center;
  background: linear-gradient(to top, transparent 0 15%, #facc15 15% 100%);
  box-shadow: 0 0 8px rgba(250, 204, 21, .65);
}
.sensor-gauge-threshold span {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(2, 6, 23, .86);
  border: 1px solid rgba(250, 204, 21, .65);
  color: #fde68a;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.sensor-hover-tooltip {
  transform: translateY(-100%);
}


/* Sensordata alert refinement. */
.admin-stream-table col.col-source { width: 150px !important; }
.admin-stream-table .source-cell { min-width: 150px; }
.source-pill { min-width: 112px; }

.frame-modal-card.modal-kind-form,
.frame-modal-card.modal-kind-form .modal-iframe {
  width: min(1880px, calc(100vw - 8px)) !important;
}
.stream-form-card.modal-form-card:has(.sensor-settings-wide) {
  max-width: 1800px !important;
}
.sensor-field-table-config {
  min-width: 1580px;
}
.sensor-field-table-config th:nth-child(1),
.sensor-field-table-config td:nth-child(1) { width: 58px; }
.sensor-field-table-config th:nth-child(2),
.sensor-field-table-config td:nth-child(2) { width: 21%; }
.sensor-field-table-config th:nth-child(3),
.sensor-field-table-config td:nth-child(3) { width: 15%; }
.sensor-field-table-config th:nth-child(4),
.sensor-field-table-config td:nth-child(4) { width: 70px; }
.sensor-field-table-config th:nth-child(5),
.sensor-field-table-config td:nth-child(5) { width: 132px; }
.sensor-field-table-config th:nth-child(6),
.sensor-field-table-config td:nth-child(6) { width: 86px; }
.sensor-field-table-config th:nth-child(7),
.sensor-field-table-config td:nth-child(7) { width: 86px; text-align: center; }
.sensor-field-table-config th:nth-child(8),
.sensor-field-table-config td:nth-child(8) { width: 86px; text-align: center; }
.sensor-field-table-config th:nth-child(9),
.sensor-field-table-config td:nth-child(9),
.sensor-field-table-config th:nth-child(10),
.sensor-field-table-config td:nth-child(10) { width: 80px; }
.sensor-field-table-config th:nth-child(11),
.sensor-field-table-config td:nth-child(11) { width: 138px; }

.live-tile-sensor .matrix-name-overlay {
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-tile-sensor .matrix-name-overlay .matrix-label-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-tile-sensor .sensor-tile-panel {
  padding-top: 30px;
}
.live-tile-sensor .sensor-gauge-only {
  padding-top: 36px;
}
.sensor-tile-title { display: none !important; }

.sensor-gauge-threshold { display: none !important; }
.sensor-gauge-threshold-line {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 96%;
  transform-origin: bottom center;
  pointer-events: none;
}
.sensor-gauge-threshold-line i {
  position: absolute;
  left: -2px;
  top: 0;
  width: 4px;
  height: 18%;
  border-radius: 999px;
  background: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, .65);
}
.sensor-gauge-threshold-line span {
  position: absolute;
  left: 8px;
  top: 2px;
  transform: rotate(var(--threshold-label-rotation, 0deg));
  transform-origin: left center;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(2, 6, 23, .78);
  border: 1px solid rgba(250, 204, 21, .55);
  color: #fde68a;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

/* Sensordata period/retention refinement. */
.frame-modal-card.modal-kind-form:not(.modal-kind-sensor-form),
.frame-modal-card.modal-kind-form:not(.modal-kind-sensor-form) .modal-iframe {
  width: min(900px, calc(100vw - 36px)) !important;
}
.frame-modal-card.modal-kind-form.modal-kind-sensor-form,
.frame-modal-card.modal-kind-form.modal-kind-sensor-form .modal-iframe {
  width: min(1960px, calc(100vw - 8px)) !important;
}
.frame-modal-card.modal-kind-form.modal-kind-sensor-form .modal-iframe {
  height: min(780px, calc(100vh - 104px)) !important;
  min-height: min(560px, calc(100vh - 104px)) !important;
}
.stream-form-card.modal-form-card:has(.sensor-settings-wide) {
  max-width: 1880px !important;
}
.sensor-field-table-wrap {
  overflow-x: visible !important;
}
.sensor-field-table-config {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
}
.sensor-field-table-config th,
.sensor-field-table-config td {
  padding: 6px 6px !important;
}
.sensor-field-table-config th:nth-child(1),
.sensor-field-table-config td:nth-child(1) { width: 54px !important; }
.sensor-field-table-config th:nth-child(2),
.sensor-field-table-config td:nth-child(2) { width: 23% !important; }
.sensor-field-table-config th:nth-child(3),
.sensor-field-table-config td:nth-child(3) { width: 16% !important; }
.sensor-field-table-config th:nth-child(4),
.sensor-field-table-config td:nth-child(4) { width: 62px !important; }
.sensor-field-table-config th:nth-child(5),
.sensor-field-table-config td:nth-child(5) { width: 118px !important; }
.sensor-field-table-config th:nth-child(6),
.sensor-field-table-config td:nth-child(6) { width: 72px !important; }
.sensor-field-table-config th:nth-child(7),
.sensor-field-table-config td:nth-child(7) { width: 78px !important; text-align: center; }
.sensor-field-table-config th:nth-child(8),
.sensor-field-table-config td:nth-child(8) { width: 82px !important; text-align: center; }
.sensor-field-table-config th:nth-child(9),
.sensor-field-table-config td:nth-child(9),
.sensor-field-table-config th:nth-child(10),
.sensor-field-table-config td:nth-child(10) { width: 72px !important; }
.sensor-field-table-config th:nth-child(11),
.sensor-field-table-config td:nth-child(11) { width: 126px !important; }
.sensor-field-table-config select,
.sensor-field-table-config input {
  max-width: 100%;
}
.sensor-field-table-config .sensor-field-view-select,
.sensor-field-table-config .sensor-color-select {
  width: 100% !important;
}
.sensor-field-table-config .sensor-unit-input {
  width: 54px !important;
}
.sensor-field-table-config .sensor-threshold-input,
.sensor-field-table-config .sensor-minmax-input {
  width: 64px !important;
}
.sensor-field-table-config .sensor-table-toggle input:disabled + span {
  opacity: .72;
  cursor: not-allowed;
}
.sensor-field-table-config .sensor-table-toggle input:disabled + span::after {
  opacity: .85;
}
.sensor-period-select {
  position: absolute;
  z-index: 8;
  top: 6px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  margin: 0;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .28);
  background: rgba(2, 6, 23, .72);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
}
.sensor-period-select select {
  width: auto;
  min-width: 108px;
  height: 25px;
  margin: 0;
  padding: 2px 22px 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background-color: rgba(15, 23, 42, .95);
}
.live-tile-sensor .sensor-line-chart {
  padding-top: 4px;
}
.sensor-gauge-threshold-line span {
  display: none !important;
}
.sensor-gauge-threshold-value {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, .46);
  background: rgba(2, 6, 23, .52);
  color: #fde68a;
  font-style: normal;
  font-size: clamp(10px, 1.6vw, 13px);
  line-height: 1.15;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.live-tile-sensor .sensor-gauge-threshold-value {
  font-size: clamp(9px, 1.5vw, 11px);
  margin-top: 4px;
}
.sensor-gauge-threshold-line i {
  height: 20%;
}
@media (max-width: 1250px) {
  .sensor-field-table-config {
    font-size: 11px;
  }
  .sensor-field-table-config th,
  .sensor-field-table-config td {
    padding: 5px 4px !important;
  }
}

/* Sensordata final refinements: wider editor modal, empty chart, local-time graph and gauge threshold tooltip. */
.frame-modal-card.modal-kind-form.modal-kind-sensor-form {
  width: min(98vw, 2200px) !important;
  max-width: min(98vw, 2200px) !important;
}
.frame-modal-card.modal-kind-form.modal-kind-sensor-form .modal-iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: min(840px, calc(100vh - 92px)) !important;
  min-height: min(620px, calc(100vh - 92px)) !important;
}
.stream-form-card.modal-form-card:has(.sensor-settings-wide) {
  width: min(96vw, 2140px) !important;
  max-width: min(96vw, 2140px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.sensor-settings-wide .sensor-field-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}
.sensor-settings-wide .sensor-field-table-config {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
.sensor-settings-wide .sensor-field-table-config th,
.sensor-settings-wide .sensor-field-table-config td {
  padding-left: 5px !important;
  padding-right: 5px !important;
}
.sensor-settings-wide .sensor-field-table-config th:nth-child(1),
.sensor-settings-wide .sensor-field-table-config td:nth-child(1) { width: 50px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(2),
.sensor-settings-wide .sensor-field-table-config td:nth-child(2) { width: 22% !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(3),
.sensor-settings-wide .sensor-field-table-config td:nth-child(3) { width: 15% !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(4),
.sensor-settings-wide .sensor-field-table-config td:nth-child(4) { width: 56px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(5),
.sensor-settings-wide .sensor-field-table-config td:nth-child(5) { width: 112px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(6),
.sensor-settings-wide .sensor-field-table-config td:nth-child(6) { width: 66px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(7),
.sensor-settings-wide .sensor-field-table-config td:nth-child(7) { width: 72px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(8),
.sensor-settings-wide .sensor-field-table-config td:nth-child(8) { width: 78px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(9),
.sensor-settings-wide .sensor-field-table-config td:nth-child(9),
.sensor-settings-wide .sensor-field-table-config th:nth-child(10),
.sensor-settings-wide .sensor-field-table-config td:nth-child(10) { width: 62px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(11),
.sensor-settings-wide .sensor-field-table-config td:nth-child(11) { width: 118px !important; }
.sensor-empty-chart-text {
  fill: rgba(203, 213, 225, .82);
  font-size: 18px;
  font-weight: 750;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(2, 6, 23, .9);
  stroke-width: 5px;
  stroke-linejoin: round;
}
.sensor-line-chart-empty .sensor-grid-line {
  stroke: rgba(148, 163, 184, .18);
}
.sensor-gauge-threshold-value {
  display: none !important;
}
.sensor-gauge-threshold-line {
  pointer-events: auto !important;
  cursor: help;
}
.sensor-gauge-threshold-line i {
  pointer-events: auto !important;
}
.sensor-gauge-only {
  position: relative;
}

/* Sensordata follow-up fix: responsive editor modal, compact aligned fields and snapshot/gauge polish. */
.frame-modal-card.modal-kind-form.modal-kind-sensor-form {
  width: min(99vw, 2280px) !important;
  max-width: min(99vw, 2280px) !important;
  height: min(99vh, 1120px) !important;
  max-height: calc(100vh - 8px) !important;
  padding: 8px !important;
}
.frame-modal-card.modal-kind-form.modal-kind-sensor-form .modal-head {
  margin-bottom: 6px !important;
}
.frame-modal-card.modal-kind-form.modal-kind-sensor-form .modal-iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: calc(100vh - 76px) !important;
  min-height: min(760px, calc(100vh - 76px)) !important;
  flex: 1 1 auto !important;
}
.stream-form-card.modal-form-card:has(.sensor-settings-wide) {
  width: calc(100vw - 28px) !important;
  max-width: none !important;
  margin: 0 auto !important;
  padding: 14px !important;
  box-sizing: border-box !important;
}
.sensor-settings-wide {
  overflow: visible !important;
}
.sensor-settings-wide .sensor-field-table-wrap {
  overflow-x: hidden !important;
  overflow-y: visible !important;
}
.sensor-settings-wide .sensor-field-table-config {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  font-size: 10.5px !important;
}
.sensor-settings-wide .sensor-field-table-config th,
.sensor-settings-wide .sensor-field-table-config td {
  padding: 4px 4px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
.sensor-settings-wide .sensor-field-table-config input,
.sensor-settings-wide .sensor-field-table-config select {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 34px !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  font-size: 11px !important;
}
.sensor-settings-wide .sensor-field-table-config th:nth-child(1),
.sensor-settings-wide .sensor-field-table-config td:nth-child(1) { width: 48px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(2),
.sensor-settings-wide .sensor-field-table-config td:nth-child(2) { width: 20% !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(3),
.sensor-settings-wide .sensor-field-table-config td:nth-child(3) { width: 14% !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(4),
.sensor-settings-wide .sensor-field-table-config td:nth-child(4) { width: 54px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(5),
.sensor-settings-wide .sensor-field-table-config td:nth-child(5) { width: 110px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(6),
.sensor-settings-wide .sensor-field-table-config td:nth-child(6) { width: 92px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(7),
.sensor-settings-wide .sensor-field-table-config td:nth-child(7) { width: 70px !important; text-align: center; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(8),
.sensor-settings-wide .sensor-field-table-config td:nth-child(8) { width: 76px !important; text-align: center; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(9),
.sensor-settings-wide .sensor-field-table-config td:nth-child(9),
.sensor-settings-wide .sensor-field-table-config th:nth-child(10),
.sensor-settings-wide .sensor-field-table-config td:nth-child(10) { width: 86px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(11),
.sensor-settings-wide .sensor-field-table-config td:nth-child(11) { width: 120px !important; }
.sensor-settings-wide .sensor-field-table-config .sensor-threshold-input,
.sensor-settings-wide .sensor-field-table-config .sensor-minmax-input {
  width: 100% !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
.sensor-settings-wide .sensor-field-table-config .sensor-unit-input {
  width: 100% !important;
}
.sensor-settings-wide .sensor-field-table-config .sensor-field-view-select,
.sensor-settings-wide .sensor-field-table-config .sensor-color-select {
  width: 100% !important;
}
.sensor-settings-wide .sensor-field-table-config .sensor-path-input {
  width: 100% !important;
  text-overflow: ellipsis;
}
.sensor-settings-wide .sensor-field-table-config .sensor-table-toggle span {
  transform: scale(.88);
  transform-origin: center;
}
.sensor-gauge-threshold-line i {
  background: #facc15 !important;
  box-shadow: 0 0 9px rgba(250,204,21,.70) !important;
}


/* Sensordata refinements - snapshots, period select, responsive modals, clock */
.admin-streams-head { position: relative; display: grid !important; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.admin-streams-head > div:first-child { justify-self: start; }
.admin-streams-head .actions { justify-self: end; }
.admin-live-clock { justify-self: center; text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text); border: 1px solid rgba(243,247,247,.35); border-radius: 999px; padding: 7px 14px; background: rgba(7,19,21,.78); white-space: nowrap; min-width: 240px; }

.frame-modal-card { width: min(1500px, calc(100vw - 18px)) !important; height: min(940px, calc(100vh - 18px)) !important; max-width: calc(100vw - 18px) !important; max-height: calc(100vh - 18px) !important; }
.frame-modal-card .modal-iframe { flex: 1 1 auto !important; width: 100% !important; min-height: 0 !important; }
.frame-modal-card.modal-kind-sensor-form { width: min(1780px, calc(100vw - 10px)) !important; height: min(1080px, calc(100vh - 10px)) !important; max-width: calc(100vw - 10px) !important; max-height: calc(100vh - 10px) !important; padding: 10px !important; }
.frame-modal-card.modal-kind-sensor-form .modal-iframe { min-height: 0 !important; }
@media (max-width: 900px) {
  .admin-streams-head { grid-template-columns: 1fr; }
  .admin-live-clock { justify-self: stretch; min-width: 0; }
  .admin-streams-head .actions { justify-self: stretch; }
  .admin-streams-head .actions .button { width: 100%; }
}

.sensor-period-select {
  top: auto !important;
  right: 10px !important;
  bottom: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  z-index: 12 !important;
}
.sensor-period-select select {
  min-width: 112px !important;
  height: 28px !important;
  border-radius: 999px !important;
  background-color: rgba(2, 6, 23, .88) !important;
  border: 1px solid rgba(148,163,184,.45) !important;
  color: #e5e7eb !important;
  font-size: 11px !important;
}
.sensor-chart-main { padding-bottom: 34px !important; }
.sensor-line-chart { height: calc(100% - 58px) !important; }

.sensor-field-table-config input.sensor-small-field,
.sensor-field-table-config select.sensor-small-field,
.sensor-field-table-config input.sensor-threshold-field,
.sensor-field-table-config input.sensor-unit-field { min-width: 0 !important; box-sizing: border-box !important; }
.sensor-field-table-config .sensor-gauge-options { display: grid !important; grid-template-columns: minmax(70px, 1fr) minmax(70px, 1fr) minmax(110px, 1.15fr) !important; gap: 6px !important; align-items: end !important; }
.sensor-field-table-config .sensor-gauge-options label { min-width: 0 !important; }
.sensor-field-table-config .sensor-gauge-options input,
.sensor-field-table-config .sensor-gauge-options select { width: 100% !important; }
.sensor-field-table-config .sensor-threshold-field { width: 96px !important; min-width: 96px !important; }

/* Let gauge threshold marker accept pointer events for tooltip while keeping the visual subtle. */
.sensor-gauge-threshold-line { pointer-events: auto !important; cursor: help; }
.sensor-gauge-threshold-line i { pointer-events: auto !important; }


/* Refinements: align period control with legend, improve gauge snapshot parity, clock text, form readability and modal height. */
.sensor-chart-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 2px !important;
  gap: 3px !important;
}
.sensor-line-chart {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
}
.sensor-chart-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 1px;
  min-height: 30px;
}
.sensor-chart-footer .sensor-legend {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 31px;
  overflow: auto;
  padding: 0;
}
.sensor-chart-footer .sensor-period-select {
  position: static !important;
  flex: 0 0 auto;
  margin-left: auto !important;
}
.sensor-period-select select {
  font-size: 12px !important;
  height: 27px !important;
}
.live-tile-sensor .sensor-legend {
  max-height: 31px !important;
  overflow: auto;
}

.admin-live-clock {
  min-width: 310px;
}

.frame-modal-card {
  height: min(98vh, 1180px) !important;
  max-height: calc(100vh - 12px) !important;
  display: flex !important;
  flex-direction: column !important;
}
.frame-modal-card .modal-iframe {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
}
.frame-modal-card.modal-kind-form:not(.modal-kind-sensor-form),
.frame-modal-card.modal-kind-form:not(.modal-kind-sensor-form) .modal-iframe {
  height: min(98vh, 1100px) !important;
}
.frame-modal-card.modal-kind-sensor-form {
  height: min(99vh, 1240px) !important;
}

.sensor-settings-wide .sensor-field-table-config {
  font-size: 13px !important;
}
.sensor-settings-wide .sensor-field-table-config th,
.sensor-settings-wide .sensor-field-table-config td {
  font-size: 13px !important;
}
.sensor-settings-wide .sensor-field-table-config input,
.sensor-settings-wide .sensor-field-table-config select {
  font-size: 13px !important;
  height: 36px !important;
}
.sensor-settings-wide .sensor-field-table-config .sensor-table-toggle span {
  transform: none !important;
}
.sensor-settings-wide .sensor-field-table-config th:nth-child(2),
.sensor-settings-wide .sensor-field-table-config td:nth-child(2) { width: 19% !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(3),
.sensor-settings-wide .sensor-field-table-config td:nth-child(3) { width: 14% !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(5),
.sensor-settings-wide .sensor-field-table-config td:nth-child(5) { width: 112px !important; }
.sensor-settings-wide .sensor-field-table-config th:nth-child(11),
.sensor-settings-wide .sensor-field-table-config td:nth-child(11) { width: 132px !important; }

.language-select {
  width: 100%;
}
.compact-access-table td.center,
.compact-access-table th.center {
  text-align: center;
}
.compact-access-table input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #1d4ed8;
}

/* User role column/readability and snapshot custom-color button refinements. */
.user-org-role-cell {
  min-width: 190px;
  width: 220px;
}
.user-org-role-select {
  min-width: 180px;
  width: 100%;
}
.compact-access-table th:nth-child(2) {
  min-width: 190px;
}
.snapshot-color-label {
  min-height: 34px !important;
  padding: 7px 12px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(243,247,247,.22) !important;
  background: rgba(255,255,255,.08) !important;
  color: #f3f7f7 !important;
  font-weight: 800 !important;
  cursor: pointer;
  line-height: 1.1;
}
.snapshot-color-label:hover {
  background: rgba(255,255,255,.14) !important;
  border-color: rgba(243,247,247,.38) !important;
}
.snapshot-color-label input[type="color"] {
  width: 28px !important;
  height: 22px !important;
  opacity: .95;
}

/* Final user/role and snapshot polish. */
.compact-access-table th:nth-child(2),
.compact-access-table td.user-org-role-cell {
  min-width: 190px;
}
.user-org-role-select {
  min-width: 180px;
  width: 100%;
}
.snapshot-color-label {
  min-height: 34px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.snapshot-color-label:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(243,247,247,.32);
}
.snapshot-color-label:focus-within {
  outline: 2px solid rgba(243,247,247,.42);
  outline-offset: 2px;
}
.snapshot-color-label span {
  display: inline-flex;
  align-items: center;
  height: 100%;
}

/* User edit modal, role table fit and final snapshot/color controls. */
.frame-modal-card.modal-kind-user-form,
.user-edit-frame-modal {
  width: min(1360px, calc(100vw - 18px)) !important;
  height: min(920px, calc(100vh - 18px)) !important;
  max-width: calc(100vw - 18px) !important;
  max-height: calc(100vh - 18px) !important;
}
.frame-modal-card.modal-kind-user-form .modal-iframe,
.user-edit-frame-modal .modal-iframe {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-height: 0 !important;
}
.user-modal-form-card,
.user-form-card {
  max-width: 1180px !important;
  width: min(1180px, 100%) !important;
  box-sizing: border-box;
}
.user-modal-form-card fieldset,
.user-form-card fieldset {
  min-width: 0;
}
.user-modal-form-card .table-wrap,
.user-form-card .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.user-modal-form-card .compact-access-table,
.user-form-card .compact-access-table {
  width: 100%;
  table-layout: fixed;
}
.user-modal-form-card .compact-access-table th:nth-child(1),
.user-form-card .compact-access-table th:nth-child(1) { width: 34%; }
.user-modal-form-card .compact-access-table th:nth-child(2),
.user-form-card .compact-access-table th:nth-child(2),
.user-modal-form-card .compact-access-table td.user-org-role-cell,
.user-form-card .compact-access-table td.user-org-role-cell {
  width: 46%;
  min-width: 260px;
}
.user-modal-form-card .compact-access-table th:nth-child(3),
.user-form-card .compact-access-table th:nth-child(3) { width: 20%; }
.user-modal-form-card .user-org-role-select,
.user-form-card .user-org-role-select {
  min-width: 0;
  width: 100%;
}
.snapshot-tools .snapshot-color-label {
  min-height: 34px !important;
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-sizing: border-box !important;
  padding: 0 12px !important;
  line-height: 1 !important;
}
.snapshot-tools .snapshot-color-label input[type="color"] {
  height: 22px !important;
  width: 28px !important;
  flex: 0 0 auto;
}

/* Snapshot annotation toolbar alignment: keep color swatches and custom color control the same height as the other toolbar buttons. */
.snapshot-tools {
  align-items: center !important;
}
.snapshot-tools > button,
.snapshot-tools .snapshot-color-label {
  height: 38px !important;
  min-height: 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  padding: 0 14px !important;
  line-height: 1 !important;
}
.snapshot-tools .snapshot-color-picker {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 38px !important;
}
.snapshot-tools .snapshot-color-swatch {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}
.snapshot-tools .snapshot-color-label input[type="color"] {
  width: 30px !important;
  height: 24px !important;
}

/* Snapshot annotation toolbar custom color alignment: center the Eigen label and native color input within the 38px toolbar height. */
.snapshot-tools .snapshot-color-label {
  align-self: center !important;
  vertical-align: middle !important;
  margin: 0 !important;
  gap: 8px !important;
}
.snapshot-tools .snapshot-color-label span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 38px !important;
  line-height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
}
.snapshot-tools .snapshot-color-label input[type="color"] {
  display: block !important;
  align-self: center !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-sizing: border-box !important;
  transform: translateY(0) !important;
}

/* Login page centered UX retained from Microsoft-login fix. */
body.login-page-body {
  min-height: 100vh;
  background: #000;
}
body.login-page-body .topbar {
  display: none !important;
}
body.login-page-body .container {
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
}
.login-card {
  width: min(440px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 30px;
  border-radius: 22px;
  text-align: left;
}
.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 0 !important;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 12px;
}
.login-card .muted,
.login-card .small {
  text-align: center;
}
.login-main-button {
  width: 100%;
  text-align: center;
  justify-content: center;
  padding: 12px 14px;
}
.login-busy {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(243,247,247,.32);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
}
.login-busy[hidden] {
  display: none !important;
}
.login-busy p {
  margin: 4px 0 0;
  text-align: left;
}
.login-spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 3px solid rgba(243,247,247,.25);
  border-top-color: #f3f7f7;
  border-radius: 999px;
  animation: login-spin .9s linear infinite;
}
body.login-processing #loginInteractive {
  display: none;
}
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (max-width: 520px) {
  body.login-page-body .container { padding: 18px; }
  .login-card { width: 100%; padding: 24px 20px; }
}

/* Requested user-management refinements. */
.user-identity-main {
  display: block;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.user-identity-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.user-identity-cell {
  min-width: 220px;
}
.frame-modal-card.modal-kind-user-form,
.user-edit-frame-modal {
  width: min(1320px, calc(100vw - 24px)) !important;
  height: auto !important;
  max-height: calc(100vh - 24px) !important;
  max-width: calc(100vw - 24px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.frame-modal-card.modal-kind-user-form .modal-iframe,
.user-edit-frame-modal .modal-iframe {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: min(760px, calc(100vh - 108px)) !important;
  min-height: min(560px, calc(100vh - 108px)) !important;
  border: 1px solid rgba(255,255,255,.22);
}
.user-modal-form-card,
.user-form-card {
  max-width: 1240px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.user-modal-form-card .table-wrap,
.user-form-card .table-wrap {
  overflow-x: visible !important;
}
.user-modal-form-card table,
.user-form-card table {
  width: 100% !important;
  table-layout: auto !important;
}
.user-org-role-cell {
  min-width: 210px;
  width: 240px;
}
.user-org-role-select {
  min-width: 190px;
  width: 100%;
}
@media (max-width: 760px) {
  .frame-modal-card.modal-kind-user-form,
  .user-edit-frame-modal {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
  }
  .frame-modal-card.modal-kind-user-form .modal-iframe,
  .user-edit-frame-modal .modal-iframe {
    height: calc(100vh - 96px) !important;
    min-height: 360px !important;
  }
  .user-modal-form-card .table-wrap,
  .user-form-card .table-wrap {
    overflow-x: auto !important;
  }
}


/* Shared source badges in source lists. */
.stream-title-with-badges,
.stream-name-with-badges {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}
.stream-title-with-badges { margin: 0 0 4px; }
.stream-name-with-badges span:first-child { min-width: 0; }
.share-pill {
  font-size: 11px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
}

/* Collapsed snapshot panel label with live count. */
.snapshot-collapsed-label {
  display: none;
  color: #f3f7f7;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.snapshot-timeline.collapsed .snapshot-collapsed-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.snapshot-timeline.collapsed .snapshot-timeline-head {
  min-height: 100%;
  gap: 10px;
}
.matrix-shell-body .matrix-only.snapshot-panel-collapsed {
  grid-template-columns: minmax(0, 1fr) 54px !important;
}

/* Stream source control feature settings (PTZ / LIFT). */
.control-features-fieldset { padding: 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; }
.stream-feature-list { display: grid; gap: 12px; }
.stream-feature-block { border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.035); padding: 12px; }
.stream-feature-block.is-disabled { opacity: .82; }
.stream-feature-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.stream-feature-settings { display: grid; gap: 12px; margin-top: 12px; }
.stream-feature-scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.feature-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.10); }
@media (max-width: 700px) { .stream-feature-scope-grid { grid-template-columns: 1fr; } }

/* Mobile navigation and requested mobile source-list refinement. */
.mobile-menu-toggle {
  display: none;
  width: 44px;
  height: 40px;
  min-width: 44px;
  padding: 0;
  margin-left: auto;
  border: 1px solid rgba(243,247,247,.28);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: #f3f7f7;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .16s ease, opacity .16s ease;
}
.topbar.mobile-menu-open .mobile-menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.mobile-menu-open .mobile-menu-toggle span:nth-child(2) { opacity: 0; }
.topbar.mobile-menu-open .mobile-menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.lift-control-grid button:disabled,
.lift-control-grid button.is-disabled {
  cursor: not-allowed;
  opacity: .55;
  filter: grayscale(.3);
}
@media (max-width: 900px) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }
  .mobile-menu-toggle { display: inline-flex; }
  .topbar .brand { min-width: 0; margin-right: 0; }
  .topbar .brand-text { max-width: calc(100vw - 92px); }
  .topbar .topnav {
    grid-column: 1 / -1;
    display: none !important;
    width: 100%;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(243,247,247,.16);
  }
  .topbar.mobile-menu-open .topnav {
    display: grid !important;
    gap: 12px;
  }
  .topbar .nav-main,
  .topbar .nav-account {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    margin-left: 0 !important;
  }
  .topbar .nav-main > a,
  .topbar .nav-main .nav-drop-button,
  .topbar .nav-account .account-control {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .topbar .nav-dropdown { display: grid; width: 100%; padding: 0 !important; margin: 0 !important; }
  .topbar .nav-dropdown::after { display: none !important; }
  .topbar .nav-menu {
    position: static !important;
    display: grid !important;
    width: 100%;
    margin-top: 6px !important;
    box-shadow: none !important;
    background: rgba(255,255,255,.035) !important;
  }
}
@media (max-width: 760px) {
  .admin-stream-table tbody tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "name name"
      "source source"
      "status key"
      "internal external"
      "actions actions" !important;
    gap: 0 10px !important;
    align-items: center !important;
    padding: 12px !important;
  }
  .admin-stream-table .name-cell { grid-area: name; }
  .admin-stream-table .source-cell { grid-area: source; }
  .admin-stream-table .status-cell { grid-area: status; }
  .admin-stream-table .key-cell { grid-area: key; }
  .admin-stream-table td:nth-of-type(3).check-cell { grid-area: internal; }
  .admin-stream-table td:nth-of-type(4).check-cell { grid-area: external; }
  .admin-stream-table .action-cell { grid-area: actions; }
  .admin-stream-table .source-cell,
  .admin-stream-table .status-cell,
  .admin-stream-table .key-cell,
  .admin-stream-table td:nth-of-type(3).check-cell,
  .admin-stream-table td:nth-of-type(4).check-cell {
    min-height: 42px !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    padding: 8px 2px !important;
  }
  .admin-stream-table .source-cell,
  .admin-stream-table .status-cell {
    display: grid !important;
    grid-template-columns: 82px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
  }
  .admin-stream-table .key-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    min-width: 66px !important;
    padding-left: 4px !important;
  }
  .admin-stream-table .key-cell::before { display: none !important; }
  .admin-stream-table .key-cell .key-button { justify-self: end !important; min-width: 56px !important; }
  .admin-stream-table td:nth-of-type(3).check-cell,
  .admin-stream-table td:nth-of-type(4).check-cell {
    display: grid !important;
    grid-template-columns: auto auto !important;
    justify-content: space-between !important;
    gap: 10px !important;
    align-items: center !important;
  }
  .admin-stream-table td:nth-of-type(3).check-cell::before,
  .admin-stream-table td:nth-of-type(4).check-cell::before,
  .admin-stream-table .source-cell::before,
  .admin-stream-table .status-cell::before {
    line-height: 1 !important;
  }
  .admin-stream-table .status-cell .pill,
  .admin-stream-table .source-cell .source-pill,
  .admin-stream-table .check-cell .matrix-check-form,
  .admin-stream-table .check-cell .admin-check-toggle {
    justify-self: end !important;
  }
  .admin-stream-table .action-cell {
    margin-top: 2px !important;
    border-bottom: 0 !important;
    padding-top: 10px !important;
  }
  .admin-stream-table .action-row {
    justify-content: flex-start !important;
  }
}

/* Final refinements: user identity wrapping and LIFT source-list state. */
.user-identity-sub {
  overflow-wrap: normal !important;
  word-break: normal !important;
  white-space: nowrap;
}
.lift-list-badge {
  background: #f59e0b !important;
  border-color: rgba(245,158,11,.8) !important;
  color: #1f1300 !important;
  font-weight: 900;
}
button[disabled],
.button[disabled],
.danger[disabled] {
  cursor: not-allowed;
  opacity: .55;
  filter: grayscale(.15);
}
.auth-password-row[hidden],
[data-lift-list-badge][hidden] {
  display: none !important;
}

/* SensorPortal 18: keep flat line-series visually light when datapoints overlap. */
.sensor-point-visible {
  stroke: none !important;
  opacity: .72;
  pointer-events: none;
}
.sensor-point-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 0;
  vector-effect: non-scaling-stroke;
  cursor: crosshair;
}
.sensor-point-hit:hover {
  stroke: rgba(255, 255, 255, .9);
  stroke-width: 1.2;
}


/* Patch 2026-05-20: mobile/tablet matrix fit, modal loading state and centered gauge gradients. */
.frame-modal-card { position: relative; }
.frame-modal-card .modal-iframe.is-loading { opacity: 0; }
.modal-loading-overlay {
  position: absolute;
  inset: 58px 10px 10px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid rgba(243,247,247,.16);
  border-radius: 16px;
  background: #050708;
  color: #f3f7f7;
  font-size: 1rem;
  letter-spacing: .01em;
}
.modal-loading-overlay[hidden] { display: none !important; }
.modal-loading-spinner {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 3px solid rgba(243,247,247,.22);
  border-top-color: #f3f7f7;
  animation: sensorportal-spin .8s linear infinite;
}
@keyframes sensorportal-spin { to { transform: rotate(360deg); } }

.sensor-gauge.center-green .sensor-gauge-arc {
  background: conic-gradient(from 270deg at 50% 100%, #ef4444 0deg, #f59e0b 45deg, #22c55e 90deg, #f59e0b 135deg, #ef4444 180deg, transparent 180deg);
}
.sensor-gauge.center-red .sensor-gauge-arc {
  background: conic-gradient(from 270deg at 50% 100%, #22c55e 0deg, #f59e0b 45deg, #ef4444 90deg, #f59e0b 135deg, #22c55e 180deg, transparent 180deg);
}

.matrix-shell-body,
.matrix-shell-body .matrix-only {
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: 100dvh !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
.matrix-shell-body .matrix-only {
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)) !important;
}
.matrix-shell-body .live-matrix-full {
  height: 100% !important;
  min-height: 0 !important;
  align-content: stretch !important;
  grid-auto-rows: minmax(0, 1fr) !important;
}
.matrix-shell-body .live-tile-screen,
.matrix-shell-body .live-tile-clean {
  min-height: 0 !important;
}
@media (max-width: 1180px), (pointer: coarse) {
  .matrix-shell-body .matrix-only {
    gap: 6px !important;
  }
  .matrix-shell-body .live-matrix-full {
    gap: 4px !important;
  }
  .matrix-shell-body .matrix-name-overlay {
    padding: 4px 6px !important;
    font-size: .78rem !important;
  }
  .matrix-shell-body .snapshot-timeline {
    min-height: 132px !important;
  }
}
@media (max-width: 980px) {
  .matrix-shell-body .matrix-only {
    grid-template-rows: minmax(0, 1fr) minmax(128px, 24dvh) !important;
  }
  .matrix-shell-body .matrix-only.snapshot-panel-collapsed {
    grid-template-rows: minmax(0, 1fr) 44px !important;
    grid-template-columns: 1fr !important;
  }
}
@media (max-height: 640px) {
  .matrix-shell-body .matrix-only {
    padding: 4px !important;
    gap: 4px !important;
  }
  .matrix-shell-body .live-matrix-full { gap: 3px !important; }
  .matrix-shell-body .snapshot-timeline { min-height: 104px !important; }
}

/* Patch 2026-05-21: show gauge scale bounds and latest data timestamp. */
.sensor-gauge-bound {
  position: absolute;
  z-index: 5;
  bottom: 3px;
  max-width: 36%;
  padding: 2px 5px;
  color: #e2e8f0;
  font-size: clamp(10px, 1.7vw, 13px);
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0,0,0,.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.sensor-gauge-min { left: 2%; text-align: left; }
.sensor-gauge-max { right: 2%; text-align: right; }
.sensor-gauge-readout .sensor-gauge-timestamp {
  margin-top: 2px;
}
.live-tile-sensor .sensor-gauge-bound {
  font-size: clamp(9px, 1.55vw, 12px);
}

/* DJI Sync settings */
.pairing-code-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.pairing-code-row .button { white-space: nowrap; }
.settings-toggle-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}
.settings-toggle-row .help { display: block; margin-top: 4px; }
.settings-toggle-row .admin-check-toggle { flex: 0 0 auto; }
@media (max-width: 760px) {
  .pairing-code-row { grid-template-columns: 1fr; }
  .pairing-code-row .button { width: 100%; }
}

/* Patch: settings toggles, token/hash alignment and mobile navigation account bar. */
.settings-form .settings-toggle-row,
.settings-form .settings-select-row {
  width: 100%;
}
.settings-select-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}
.settings-select-row .help { display: block; margin-top: 4px; }
.settings-select-row select { flex: 0 0 220px; max-width: 100%; }
.settings-select-row.is-hidden { display: none !important; }

.token-create-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}
.token-create-form input[name="label"] {
  width: min(360px, 100%);
  flex: 0 1 360px;
}
.token-create-form button { white-space: nowrap; }
.token-access-table td { vertical-align: middle !important; }
.token-access-table td input { margin-top: 0; margin-bottom: 0; }
.token-access-table .token-link-cell {
  vertical-align: middle !important;
}
.token-access-table .copy-row,
.token-access-table .token-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 38px;
}
.token-access-table .copy-row input,
.token-access-table .token-copy-row input {
  display: block;
  height: 38px;
  margin: 0;
  align-self: center;
}
.token-access-table .copy-row .button,
.token-access-table .token-copy-row .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  margin: 0;
  align-self: center;
  white-space: nowrap;
}

.mobile-account-bar { display: none; }
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }
  .mobile-account-bar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding-top: 2px;
  }
  .mobile-account-left { min-width: 0; flex: 1 1 auto; }
  .mobile-account-bar .org-switcher.account-control {
    width: auto;
    max-width: min(60vw, 260px);
    min-width: min(48vw, 190px);
  }
  .mobile-account-bar .mobile-logout-form {
    display: inline-flex;
    margin: 0;
    flex: 0 0 auto;
  }
  .topbar .topnav {
    border-top: 1px solid rgba(243,247,247,.16);
  }
  .topbar .topnav .nav-account {
    display: none !important;
  }
  .topbar .nav-main > a,
  .topbar .nav-main .nav-drop-button,
  .topbar .nav-main .nav-menu a {
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    background: rgba(255,255,255,.045);
    color: #f3f7f7;
    font-weight: 800;
    text-decoration: none;
  }
  .topbar .nav-main .nav-drop-button {
    display: flex;
    align-items: center;
  }
  .topbar .nav-menu {
    gap: 6px !important;
    margin-top: 6px !important;
    padding: 0 0 0 12px !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .topbar .nav-main .nav-menu a {
    background: rgba(255,255,255,.025);
    color: rgba(243,247,247,.88);
    font-weight: 750;
  }
}
@media (max-width: 560px) {
  .token-create-form { display: grid; grid-template-columns: 1fr; }
  .token-create-form input[name="label"],
  .token-create-form button { width: 100%; }
  .mobile-account-bar .org-switcher.account-control { min-width: 0; max-width: 54vw; }
}

.embed-audio-panel {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid rgba(243,247,247,.20);
  border-radius: 999px;
  background: rgba(0,0,0,.52);
  color: #f3f7f7;
  backdrop-filter: blur(8px);
}
.embed-audio-panel[hidden] { display: none !important; }
.embed-audio-toggle,
.embed-audio-sync {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(243,247,247,.28);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #f3f7f7;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .03em;
  cursor: pointer;
}
.embed-audio-toggle:hover,
.embed-audio-toggle.active,
.embed-audio-sync:hover,
.embed-audio-sync.active {
  background: rgba(166,231,188,.22);
  border-color: rgba(166,231,188,.7);
  color: #d8ffe4;
}
.embed-audio-volume {
  width: 92px;
  max-width: 22vw;
  accent-color: #a6e7bc;
}
.embed-audio-volume[hidden],
.embed-audio-volume-label[hidden],
.embed-audio-sync[hidden] { display: none !important; }
.embed-audio-volume-label {
  min-width: 36px;
  font-size: 11px;
  font-weight: 900;
  color: rgba(243,247,247,.88);
}


/* Patch: compact matrix title bar and lean startup controls.
   Keep the custom audio, volume, sync, snapshot, PTZ and lift controls visible
   without allowing the title bar to wrap into a taller two-line chrome. */
.matrix-shell-body .matrix-name-overlay {
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  padding: 3px 8px !important;
  gap: 4px !important;
  display: flex !important;
  align-items: center !important;
  align-content: center !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}
.matrix-shell-body .matrix-name-overlay .matrix-label-text {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  line-height: 1.1 !important;
}
.matrix-shell-body .audio-tile-button,
.matrix-shell-body .audio-sync-button,
.matrix-shell-body .ptz-tile-button,
.matrix-shell-body .lift-tile-button {
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  padding: 0 6px !important;
  font-size: 10px !important;
  line-height: 1 !important;
  letter-spacing: .02em !important;
  white-space: nowrap !important;
}
.matrix-shell-body .snapshot-tile-button {
  width: 26px !important;
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  font-size: 12px !important;
}
.matrix-shell-body .audio-tile-volume {
  flex: 0 0 56px !important;
  width: 56px !important;
  max-width: 56px !important;
  height: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
}
.matrix-shell-body .audio-volume-label {
  flex: 0 0 24px !important;
  min-width: 24px !important;
  max-width: 28px !important;
  font-size: 9px !important;
  line-height: 1 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}
.matrix-shell-body .ptz-panel,
.matrix-shell-body .lift-panel {
  top: 34px !important;
  max-height: calc(100% - 44px) !important;
}
.matrix-shell-body .live-tile-sensor .sensor-tile-panel {
  padding-top: 30px !important;
}
.matrix-shell-body .live-tile-sensor .sensor-gauge-only {
  padding-top: 34px !important;
}
.app-grid{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));}
.app-tile{display:flex;align-items:center;gap:18px;text-decoration:none;color:inherit;min-height:150px;transition:transform .15s ease, box-shadow .15s ease;}
.app-tile:hover{transform:translateY(-2px);}
.tile-icon{width:56px;height:56px;border-radius:18px;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:22px;background:var(--accent-soft,rgba(65,105,225,.12));color:var(--accent,#3157d5);flex:0 0 auto;}
.tile-body{flex:1;min-width:0}.tile-body h2{margin:0 0 6px}.tile-body p{margin:0 0 4px}.grid-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px;align-items:end}.grid-form .full-span{grid-column:1/-1}.check-row{display:flex;gap:10px;align-items:center}.table-wrap{overflow-x:auto}.actions{white-space:nowrap}.filter-form{max-width:520px}.alert{margin:0 0 18px;padding:12px 14px;border-radius:14px;background:rgba(65,105,225,.10)}.alert.error{background:rgba(220,38,38,.10);color:#991b1b}.alert.success{background:rgba(22,163,74,.10);color:#166534}.topnav.is-open{display:flex!important}

/* FRD Portal updates: editable admin records, logos and detached square application tiles. */
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}
.grid-form .full-span,
.full-span {
  grid-column: 1 / -1;
}
.form-button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 45px;
  margin-top: 24px;
}
.check-row input {
  width: auto;
  margin: 0;
}
input[readonly] {
  background: #f3f5f8;
  color: #667085;
}
.action-stack {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.logo-cell {
  width: 72px;
}
.table-logo,
.mini-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(31, 41, 55, .12);
  background: #f8fafc;
  object-fit: contain;
  padding: 5px;
  font-weight: 800;
}
.portal-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 230px));
  gap: 26px;
  align-items: stretch;
}
.portal-app-tile {
  width: 230px;
  min-height: 230px;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(217, 222, 232, .95);
  background:
    radial-gradient(circle at top left, rgba(36, 84, 255, .10), transparent 38%),
    #ffffff;
  color: var(--text);
  box-shadow: 0 14px 36px rgba(17, 24, 39, .08);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  text-decoration: none;
}
.portal-app-tile:hover {
  transform: translateY(-4px);
  border-color: rgba(36, 84, 255, .38);
  box-shadow: 0 20px 48px rgba(17, 24, 39, .14);
  text-decoration: none;
}
.portal-tile-logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(217, 222, 232, .9);
  background: rgba(248, 250, 252, .95);
  overflow: hidden;
  flex: 0 0 auto;
}
.portal-tile-logo {
  max-width: 52px;
  max-height: 52px;
  object-fit: contain;
  display: block;
}
.portal-tile-icon {
  font-size: 25px;
  font-weight: 850;
  color: var(--primary);
  letter-spacing: -.02em;
}
.portal-tile-content {
  min-width: 0;
  flex: 1 1 auto;
}
.portal-tile-content h2 {
  margin: 0 0 7px;
  font-size: 20px;
  line-height: 1.14;
}
.portal-tile-content p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.portal-tile-action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  background: #eef2ff;
  color: #243b7a;
  font-weight: 800;
  font-size: 13px;
}
@media (max-width: 760px) {
  .grid-form { grid-template-columns: 1fr; }
  .check-row { margin-top: 0; }
  .portal-tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
  }
  .portal-app-tile {
    width: 100%;
    min-height: 190px;
    padding: 18px;
  }
}

/* Portal hardening/UI patch: keep all action controls readable in the dark Futurised theme. */
button,
.button,
a.button,
input[type="submit"] {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  box-sizing: border-box;
  background: #050708 !important;
  color: #f3f7f7 !important;
  border: 1px solid rgba(243,247,247,.72) !important;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none !important;
}
button:hover,
.button:hover,
a.button:hover,
input[type="submit"]:hover {
  background: #f3f7f7 !important;
  color: #050708 !important;
  border-color: #f3f7f7 !important;
}
button.primary,
.button.primary,
a.button.primary,
.primary {
  background: #f3f7f7 !important;
  color: #050708 !important;
  border-color: #f3f7f7 !important;
}
button.primary:hover,
.button.primary:hover,
a.button.primary:hover,
.primary:hover {
  background: #050708 !important;
  color: #f3f7f7 !important;
}
button.danger,
.button.danger,
a.button.danger,
.danger {
  background: #120606 !important;
  color: #ff8a86 !important;
  border-color: #ff716d !important;
}
button.danger:hover,
.button.danger:hover,
a.button.danger:hover,
.danger:hover {
  background: #ff716d !important;
  color: #050708 !important;
}
.account-control {
  background: #050708 !important;
  color: #f3f7f7 !important;
  border-color: rgba(243,247,247,.42) !important;
}
.account-control:hover {
  background: #f3f7f7 !important;
  color: #050708 !important;
}
button[disabled],
.button[disabled],
button:disabled,
.button.is-disabled {
  cursor: not-allowed;
  opacity: .55;
  background: #15191a !important;
  color: rgba(243,247,247,.62) !important;
  border-color: rgba(243,247,247,.28) !important;
}

/* Final button readability patch: remove white action buttons and align all controls with the dark Futurised interface. */
:root {
  --frd-control-bg: #071315;
  --frd-control-bg-hover: #102f33;
  --frd-control-border: rgba(243,247,247,.72);
  --frd-control-text: #f3f7f7;
  --frd-control-accent: #a6e7bc;
  --frd-control-accent-hover: #8ed9aa;
  --frd-control-accent-text: #03110a;
  --frd-control-danger-bg: #1b0707;
  --frd-control-danger: #ff716d;
}

button,
.button,
a.button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.account-control,
.nav-drop-button,
.row-button,
.key-button,
.icon-button,
.mini-toggle,
.snapshot-tools button,
.snapshot-timeline-refresh,
.snapshot-timeline-toggle,
.snapshot-close,
.snapshot-delete,
.snapshot-tile-button,
.snapshot-viewer-close,
.audio-tile-button,
.audio-sync-button,
.ptz-tile-button,
.lift-tile-button,
.ptz-panel-head button,
.ptz-control-grid button,
.ptz-zoom-row button,
.lift-panel-head button,
.lift-control-grid button {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: var(--frd-control-bg) !important;
  color: var(--frd-control-text) !important;
  border-color: var(--frd-control-border) !important;
  text-shadow: none !important;
  box-shadow: none;
}

button:hover,
.button:hover,
a.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
.account-control:hover,
.nav-drop-button:hover,
.row-button:hover,
.key-button:hover,
.icon-button:hover,
.mini-toggle:hover,
.snapshot-tools button:hover,
.snapshot-timeline-refresh:hover,
.snapshot-timeline-toggle:hover,
.snapshot-close:hover,
.snapshot-delete:hover,
.snapshot-tile-button:hover,
.snapshot-viewer-close:hover,
.audio-tile-button:hover,
.audio-sync-button:hover,
.ptz-tile-button:hover,
.lift-tile-button:hover,
.ptz-panel-head button:hover,
.ptz-control-grid button:hover,
.ptz-zoom-row button:hover,
.lift-panel-head button:hover,
.lift-control-grid button:hover {
  background: var(--frd-control-bg-hover) !important;
  color: var(--frd-control-text) !important;
  border-color: var(--frd-control-accent) !important;
}

button.primary,
.button.primary,
a.button.primary,
input[type="submit"].primary,
.primary,
.snapshot-tools button.primary,
.snapshot-tools button.active,
.mini-toggle.is-on,
.audio-tile-button.active,
.audio-sync-button.active,
.lift-tile-button {
  background: var(--frd-control-accent) !important;
  color: var(--frd-control-accent-text) !important;
  border-color: var(--frd-control-accent) !important;
}

button.primary:hover,
.button.primary:hover,
a.button.primary:hover,
input[type="submit"].primary:hover,
.primary:hover,
.snapshot-tools button.primary:hover,
.snapshot-tools button.active:hover,
.mini-toggle.is-on:hover,
.audio-tile-button.active:hover,
.audio-sync-button.active:hover,
.lift-tile-button:hover {
  background: var(--frd-control-accent-hover) !important;
  color: var(--frd-control-accent-text) !important;
  border-color: var(--frd-control-accent-hover) !important;
}

button.danger,
.button.danger,
a.button.danger,
.danger,
.snapshot-delete,
button[name="delete"],
button[data-danger="true"] {
  background: var(--frd-control-danger-bg) !important;
  color: var(--frd-control-danger) !important;
  border-color: var(--frd-control-danger) !important;
}

button.danger:hover,
.button.danger:hover,
a.button.danger:hover,
.danger:hover,
.snapshot-delete:hover,
button[name="delete"]:hover,
button[data-danger="true"]:hover {
  background: rgba(255,113,109,.18) !important;
  color: #ffc7c5 !important;
  border-color: #ffc7c5 !important;
}

button:focus-visible,
.button:focus-visible,
a.button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
input[type="reset"]:focus-visible,
.account-control:focus-visible,
.nav-drop-button:focus-visible {
  outline: 2px solid var(--frd-control-accent) !important;
  outline-offset: 2px !important;
}

button[disabled],
.button[disabled],
button:disabled,
.button.is-disabled,
button[aria-disabled="true"],
.button[aria-disabled="true"] {
  background: #121819 !important;
  color: rgba(243,247,247,.54) !important;
  border-color: rgba(243,247,247,.22) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* The tile CTA is not a form button, but it visually read as a white button on the dark portal; keep it aligned too. */
.portal-tile-action {
  background: rgba(166,231,188,.16) !important;
  color: #d8ffe4 !important;
  border: 1px solid rgba(166,231,188,.36) !important;
}

/* Logo/thumb containers stay intentionally light for image contrast; do not let the global button rules affect color swatches. */
.snapshot-color-swatch {
  color: transparent !important;
  border-color: rgba(243,247,247,.26) !important;
}

/* Application portal tiles: dark Futurised look/feel for the app launch buttons. */
.portal-tile-grid {
  align-items: stretch;
}

.portal-app-tile,
a.portal-app-tile,
.app-tile,
a.app-tile {
  background:
    radial-gradient(circle at 18% 12%, rgba(166, 231, 188, .18), transparent 36%),
    linear-gradient(145deg, #071315 0%, #050708 68%, #000000 100%) !important;
  color: #f3f7f7 !important;
  border: 1px solid rgba(243, 247, 247, .64) !important;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .36) !important;
  text-decoration: none !important;
}

.portal-app-tile:hover,
.portal-app-tile:focus-visible,
a.portal-app-tile:hover,
a.portal-app-tile:focus-visible,
.app-tile:hover,
.app-tile:focus-visible,
a.app-tile:hover,
a.app-tile:focus-visible {
  background:
    radial-gradient(circle at 18% 12%, rgba(166, 231, 188, .26), transparent 38%),
    linear-gradient(145deg, #102f33 0%, #071315 68%, #020303 100%) !important;
  color: #ffffff !important;
  border-color: rgba(166, 231, 188, .88) !important;
  box-shadow: 0 22px 54px rgba(0, 0, 0, .48) !important;
  text-decoration: none !important;
}

.portal-app-tile:focus-visible,
a.portal-app-tile:focus-visible,
.app-tile:focus-visible,
a.app-tile:focus-visible {
  outline: 2px solid #a6e7bc !important;
  outline-offset: 3px !important;
}

.portal-app-tile .portal-tile-content h2,
.portal-app-tile h2,
.app-tile h2,
.portal-app-tile .tile-body h2,
.app-tile .tile-body h2 {
  color: #f3f7f7 !important;
}

.portal-app-tile .muted,
.portal-app-tile .portal-tile-content p,
.portal-app-tile .small,
.app-tile .muted,
.app-tile .tile-body p,
.app-tile .small {
  color: #b7c7ca !important;
}

.portal-tile-logo-wrap,
.portal-app-tile .portal-tile-logo-wrap,
.app-tile .tile-icon {
  background: rgba(243, 247, 247, .08) !important;
  border: 1px solid rgba(243, 247, 247, .28) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05) !important;
}

.portal-tile-icon,
.portal-app-tile .portal-tile-icon,
.app-tile .tile-icon {
  color: #a6e7bc !important;
}

.portal-tile-action,
.portal-app-tile .portal-tile-action {
  background: rgba(166, 231, 188, .18) !important;
  color: #d8ffe4 !important;
  border: 1px solid rgba(166, 231, 188, .48) !important;
  box-shadow: none !important;
}

.portal-app-tile:hover .portal-tile-action,
.portal-app-tile:focus-visible .portal-tile-action {
  background: #a6e7bc !important;
  color: #03110a !important;
  border-color: #a6e7bc !important;
}


/* FRD Portal customer dashboard and final button/tile polish */
:root {
  --accent-soft: rgba(243,247,247,.12);
  --accent-line: rgba(243,247,247,.58);
}

/* Remove green accent remnants from the portal surface; SensorPortal style is monochrome/white on black. */
.portal-app-tile,
.portal-app-tile *,
.dashboard-card,
.dashboard-card *,
.futurised-news-item,
.futurised-news-item * { color: inherit; }
.portal-app-tile .muted,
.dashboard-card .muted,
.futurised-news-item p { color: var(--muted) !important; }
.portal-app-tile {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 120px;
  padding: 22px;
  border: 2px solid rgba(243,247,247,.76) !important;
  border-radius: 22px;
  background: linear-gradient(145deg, #071315 0%, #030607 100%) !important;
  color: #f3f7f7 !important;
  box-shadow: 0 20px 52px rgba(0,0,0,.48), inset 0 0 0 1px rgba(255,255,255,.04);
  overflow: hidden;
  transform: translateY(0);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.portal-app-tile::before {
  content: "";
  position: absolute;
  inset: -40% auto auto -18%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(243,247,247,.12), transparent 62%);
  opacity: .8;
  pointer-events: none;
}
.portal-app-tile:hover,
.portal-app-tile:focus-visible {
  color: #f3f7f7 !important;
  transform: translateY(-3px);
  border-color: #f3f7f7 !important;
  box-shadow: 0 28px 70px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.08);
  outline: none;
}
.portal-tile-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(243,247,247,.34);
  overflow: hidden;
  z-index: 1;
}
.portal-tile-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.portal-tile-icon { font-size: 1.35rem; font-weight: 900; color: #f3f7f7 !important; }
.portal-tile-content { min-width: 0; z-index: 1; }
.portal-tile-content h2 { margin: 0 0 6px; font-size: 1.15rem; color: #f3f7f7 !important; }
.portal-tile-content p { margin: 0; }
.portal-tile-action {
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(243,247,247,.66);
  background: #f3f7f7 !important;
  color: #000 !important;
  font-weight: 900;
  letter-spacing: .01em;
}
.portal-app-tile:hover .portal-tile-action,
.portal-app-tile:focus-visible .portal-tile-action {
  background: #000 !important;
  color: #f3f7f7 !important;
}

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 28px;
  align-items: center;
  margin: 28px 0 22px;
  padding: 34px;
  border: 2px solid rgba(243,247,247,.74);
  border-radius: 30px;
  background: linear-gradient(135deg, #071315 0%, #020405 55%, #000 100%);
  overflow: hidden;
  box-shadow: 0 26px 80px rgba(0,0,0,.62);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.06) 45%, transparent 68%);
  transform: translateX(-100%);
  animation: dashboardSheen 7s ease-in-out infinite;
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; }
.hero-copy h1 { margin: 0 0 10px; font-size: clamp(2rem, 5vw, 4rem); line-height: .95; letter-spacing: -.05em; }
.hero-copy p { max-width: 680px; }
.hero-orb { position: relative; z-index: 1; height: 220px; }
.hero-orb span {
  position: absolute;
  border: 1px solid rgba(243,247,247,.48);
  border-radius: 999px;
  animation: orbitFloat 8s ease-in-out infinite;
}
.hero-orb span:nth-child(1) { inset: 18px 34px 34px 18px; }
.hero-orb span:nth-child(2) { inset: 48px 6px 20px 58px; animation-delay: -2s; }
.hero-orb span:nth-child(3) { inset: 86px 70px 58px 0; animation-delay: -4s; background: rgba(255,255,255,.06); }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr);
  gap: 18px;
  margin: 0 0 28px;
}
.dashboard-card {
  position: relative;
  min-height: 220px;
  padding: 22px;
  border: 1px solid rgba(243,247,247,.56);
  border-radius: 24px;
  background: linear-gradient(145deg, #071315 0%, #030607 100%);
  overflow: hidden;
  box-shadow: 0 18px 54px rgba(0,0,0,.45);
}
.dashboard-card.wide { min-height: 220px; }
.card-kicker, .eyebrow {
  color: rgba(243,247,247,.72) !important;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .74rem;
  font-weight: 900;
}
.dashboard-card h2 { margin: 4px 0 12px; font-size: 1.3rem; color: #f3f7f7; }
.card-header-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.weather-state { color: var(--muted); font-size: .9rem; }
.weather-main { margin: 18px 0 10px; font-size: clamp(2.6rem, 8vw, 5rem); font-weight: 900; line-height: 1; letter-spacing: -.06em; color: #f3f7f7; }
.weather-main small { font-size: .35em; color: var(--muted); }
.news-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.news-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(243,247,247,.18);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
  color: #f3f7f7 !important;
  min-height: 98px;
}
.news-item:hover { border-color: rgba(243,247,247,.58); background: rgba(255,255,255,.07); }
.news-thumb, .futurised-news-image {
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.03));
  background-size: cover;
  background-position: center;
  min-height: 78px;
}
.news-item strong { display: block; color: #f3f7f7; font-size: .92rem; line-height: 1.18; margin-bottom: 5px; }
.news-item p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.futurised-news-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.futurised-news-item {
  display: grid;
  grid-template-rows: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(243,247,247,.18);
  border-radius: 20px;
  background: rgba(255,255,255,.035);
  color: #f3f7f7 !important;
  min-height: 230px;
}
.futurised-news-item:hover { border-color: rgba(243,247,247,.58); background: rgba(255,255,255,.07); }
.futurised-news-item strong { color: #f3f7f7; }
.futurised-news-item p { margin: 6px 0 0; font-size: .86rem; line-height: 1.38; }
.empty-dashboard-state { border: 1px dashed rgba(243,247,247,.26); border-radius: 18px; padding: 18px; }
.pulse-dot { width: 12px; height: 12px; border-radius: 50%; background: #f3f7f7; box-shadow: 0 0 0 0 rgba(243,247,247,.65); animation: pulseWhite 2.8s infinite; }
.apps-heading { margin-top: 8px; }

@keyframes dashboardSheen { 0%, 46% { transform: translateX(-100%); } 68%, 100% { transform: translateX(100%); } }
@keyframes orbitFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
@keyframes pulseWhite { 0% { box-shadow: 0 0 0 0 rgba(243,247,247,.58); } 70% { box-shadow: 0 0 0 12px rgba(243,247,247,0); } 100% { box-shadow: 0 0 0 0 rgba(243,247,247,0); } }

@media (max-width: 900px) {
  .dashboard-hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-orb { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .news-list, .futurised-news-strip { grid-template-columns: 1fr; }
  .portal-app-tile { grid-template-columns: 60px minmax(0, 1fr); }
  .portal-tile-action { grid-column: 1 / -1; width: 100%; }
}

/* Customer portal dashboard refinement: monochrome SensorPortal-style accents, logo motion, app-first layout and settings modal. */
:root {
  --frd-control-accent: #f3f7f7;
  --frd-control-accent-hover: #ffffff;
  --frd-control-accent-text: #050708;
  --ok: #f3f7f7;
}
.portal-app-tile,
.portal-app-tile:hover,
.portal-app-tile:focus-visible {
  background: linear-gradient(145deg, #071315 0%, #030607 100%) !important;
  border-color: rgba(243,247,247,.76) !important;
}
.portal-app-tile::before {
  background: radial-gradient(circle, rgba(243,247,247,.12), transparent 62%) !important;
}
.portal-tile-icon,
.portal-tile-action,
.card-kicker,
.eyebrow,
.weather-icon,
.lift-status,
.ptz-status,
.ptz-range-value {
  color: #f3f7f7 !important;
}
.portal-tile-action,
.portal-app-tile:hover .portal-tile-action,
.portal-app-tile:focus-visible .portal-tile-action {
  background: #f3f7f7 !important;
  color: #000 !important;
  border-color: #f3f7f7 !important;
}
.dashboard-hero {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 240px);
  margin-bottom: 18px;
}
.hero-logo-motion {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 210px;
}
.hero-logo-motion::before,
.hero-logo-motion::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(243,247,247,.22);
  inset: 20px;
  border-radius: 36px;
  animation: logoFrameFloat 8s ease-in-out infinite;
}
.hero-logo-motion::after {
  inset: 48px 8px 8px 48px;
  animation-delay: -3s;
  background: linear-gradient(145deg, rgba(255,255,255,.045), transparent);
}
.hero-logo-motion img {
  width: min(160px, 70%);
  height: auto;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 24px 42px rgba(0,0,0,.78));
  animation: logoPulseFloat 7s ease-in-out infinite;
}
@keyframes logoPulseFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: .96; }
  50% { transform: translateY(-10px) scale(1.035); opacity: 1; }
}
@keyframes logoFrameFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: .55; }
  50% { transform: translateY(8px) rotate(2deg); opacity: .9; }
}
.apps-heading-top { margin: 8px 0 14px; }
.priority-apps-grid { margin-bottom: 28px; }
.app-empty-top { margin-bottom: 28px; }
.dashboard-grid {
  grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr);
}
.weather-card { display: flex; flex-direction: column; }
.weather-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 6px 0 4px;
  border: 1px solid rgba(243,247,247,.35);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
  font-size: 2rem;
}
.dashboard-card[data-refreshing="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,.035), transparent);
  transform: translateX(-100%);
  animation: dashboardSheen 1.1s ease-out;
  pointer-events: none;
}
.account-settings-trigger { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-backdrop[hidden] { display: none !important; }
.settings-modal { width: min(520px, calc(100vw - 32px)); }
.settings-form { display: grid; gap: 14px; }
.settings-user-card {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid rgba(243,247,247,.18);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
}
.settings-check { margin: 0; }
.nav-account { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-logo[src^="/static/uploads/"],
.portal-tile-logo[src^="/static/uploads/"] { background: transparent; }
@media (max-width: 900px) {
  .dashboard-hero { grid-template-columns: 1fr; }
  .hero-logo-motion { min-height: 150px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}


/* Dashboard v3: restore app-tile look, compact weather/update stack, paged news and mobile polish. */
.dashboard-hero {
  margin-top: clamp(14px, 3vw, 28px);
}

.portal-tile-grid.priority-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  align-items: stretch;
  margin-bottom: 24px;
}
.portal-app-tile,
a.portal-app-tile {
  position: relative;
  display: grid !important;
  grid-template-columns: 72px minmax(0, 1fr) auto !important;
  aspect-ratio: auto !important;
  width: auto !important;
  min-height: 120px !important;
  padding: 22px !important;
  gap: 18px !important;
  align-items: center !important;
  border-radius: 22px !important;
  border: 2px solid rgba(243,247,247,.76) !important;
  background: linear-gradient(145deg, #071315 0%, #030607 100%) !important;
  box-shadow: 0 20px 52px rgba(0,0,0,.48), inset 0 0 0 1px rgba(255,255,255,.04) !important;
  color: #f3f7f7 !important;
}
.portal-app-tile::before {
  content: "";
  position: absolute;
  inset: -40% auto auto -18%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(243,247,247,.12), transparent 62%) !important;
  opacity: .8;
  pointer-events: none;
}
.portal-app-tile:hover,
.portal-app-tile:focus-visible,
a.portal-app-tile:hover,
a.portal-app-tile:focus-visible {
  transform: translateY(-3px) !important;
  border-color: #f3f7f7 !important;
  background: linear-gradient(145deg, #102327 0%, #071315 68%, #020303 100%) !important;
  box-shadow: 0 28px 70px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.08) !important;
  text-decoration: none !important;
}
.portal-tile-logo-wrap,
.portal-app-tile .portal-tile-logo-wrap {
  width: 72px !important;
  height: 72px !important;
  border-radius: 20px !important;
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(243,247,247,.34) !important;
}
.portal-tile-content h2,
.portal-app-tile h2 {
  color: #f3f7f7 !important;
  margin: 0 0 6px !important;
}
.portal-app-tile .muted,
.portal-app-tile .small,
.portal-app-tile .portal-tile-content p {
  color: #b7c7ca !important;
}
.portal-tile-action,
.portal-app-tile .portal-tile-action,
.portal-app-tile:hover .portal-tile-action,
.portal-app-tile:focus-visible .portal-tile-action {
  justify-self: end;
  background: #f3f7f7 !important;
  color: #000 !important;
  border: 1px solid #f3f7f7 !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(0, 1.38fr) !important;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.weather-card {
  grid-column: 1;
  grid-row: 1;
  min-height: 0 !important;
  height: 258px;
  padding: 18px 20px !important;
}
.futurised-card {
  grid-column: 1;
  grid-row: 2;
  min-height: 0 !important;
  height: 258px;
  padding: 18px 20px !important;
}
.news-card {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 534px !important;
  height: 534px;
  display: flex;
  flex-direction: column;
}
.weather-card .card-kicker {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.weather-icon {
  width: 50px !important;
  height: 50px !important;
  margin: 2px 0 0 !important;
  border-radius: 16px !important;
  font-size: 1.65rem !important;
}
.weather-main {
  margin: 8px 0 4px !important;
  font-size: clamp(2.3rem, 5.5vw, 3.7rem) !important;
}
.weather-state { margin-top: 6px; }
.weather-card [data-weather-detail] { margin-top: 4px; }

.news-list {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  max-height: 438px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  padding-right: 6px;
}
.news-page {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
  scroll-snap-align: start;
}
.news-item {
  min-height: 0 !important;
  height: 100%;
  grid-template-columns: 78px minmax(0, 1fr) !important;
}
.news-thumb {
  min-height: 74px !important;
  height: 100%;
}
.news-item p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-list::-webkit-scrollbar { width: 8px; }
.news-list::-webkit-scrollbar-thumb { background: rgba(243,247,247,.24); border-radius: 999px; }
.news-list::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 999px; }

.futurised-news-strip {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  margin-top: 6px;
}
.futurised-news-item {
  grid-template-columns: 82px minmax(0, 1fr) !important;
  grid-template-rows: none !important;
  min-height: 76px !important;
  padding: 9px !important;
  gap: 10px !important;
  border-radius: 16px !important;
}
.futurised-news-image {
  min-height: 58px !important;
  height: 100%;
  border-radius: 12px !important;
}
.futurised-news-item p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .82rem !important;
}

@media (max-width: 1100px) {
  .portal-tile-grid.priority-apps-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto;
  }
  .weather-card,
  .futurised-card,
  .news-card {
    grid-column: auto;
    grid-row: auto;
    height: auto;
  }
  .weather-card,
  .futurised-card { min-height: 220px !important; }
  .news-card { min-height: 500px !important; }
  .news-list { max-height: 420px; }
}

@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .topbar { padding: 12px 14px; }
  .container { margin: 16px auto; padding: 0 12px; }
  .dashboard-hero {
    padding: 20px;
    border-radius: 24px;
    gap: 12px;
  }
  .hero-copy h1 { font-size: clamp(1.85rem, 10vw, 2.8rem); }
  .hero-logo-motion { min-height: 112px !important; }
  .hero-logo-motion img { width: min(112px, 52vw); }
  .apps-heading-top { margin-top: 4px; }
  .portal-tile-grid.priority-apps-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .portal-app-tile,
  a.portal-app-tile {
    grid-template-columns: 58px minmax(0, 1fr) !important;
    min-height: 112px !important;
    padding: 16px !important;
    gap: 14px !important;
    border-radius: 20px !important;
  }
  .portal-tile-logo-wrap,
  .portal-app-tile .portal-tile-logo-wrap {
    width: 58px !important;
    height: 58px !important;
    border-radius: 16px !important;
  }
  .portal-tile-content p {
    -webkit-line-clamp: 2;
  }
  .portal-tile-action,
  .portal-app-tile .portal-tile-action {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    min-height: 38px;
  }
  .dashboard-card {
    border-radius: 22px;
    padding: 18px !important;
  }
  .weather-card { min-height: 210px !important; }
  .news-card { min-height: 560px !important; }
  .news-list {
    max-height: 470px;
    padding-right: 2px;
  }
  .news-page {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
  .news-item {
    grid-template-columns: 72px minmax(0, 1fr) !important;
    min-height: 104px !important;
  }
  .news-thumb { min-height: 70px !important; }
  .futurised-card { min-height: 240px !important; }
  .settings-modal { width: calc(100vw - 22px); }
  .modal-card { max-height: calc(100dvh - 26px); overflow: auto; }
  .nav-account { width: 100%; }
  .account-settings-trigger, .logout-form, .logout-form button { width: 100%; max-width: none; }
}

@media (max-width: 420px) {
  .news-item { grid-template-columns: 1fr !important; }
  .news-thumb { height: 92px !important; }
  .weather-main { font-size: 3rem !important; }
}

/* Dashboard v4: compact weather metrics, automatic news carousel and cleaner app tiles. */
.portal-app-tile,
a.portal-app-tile {
  grid-template-columns: 72px minmax(0, 1fr) !important;
}
.portal-tile-action,
.portal-app-tile .portal-tile-action {
  display: none !important;
}
.portal-tile-content h2,
.portal-app-tile h2 {
  margin-bottom: 0 !important;
}
.portal-tile-content p:not(.small),
.portal-app-tile .portal-tile-content p:not(.small) {
  display: none !important;
}
.weather-card {
  height: 218px !important;
  padding: 14px 18px !important;
  gap: 8px;
  overflow: hidden;
}
.weather-title-line {
  align-items: flex-start;
  margin-bottom: 0 !important;
}
.weather-title-line h2 {
  margin: 0 !important;
  font-size: clamp(1.25rem, 2vw, 1.7rem) !important;
  line-height: 1.05;
}
.weather-location {
  color: #f3f7f7;
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.1;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.weather-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}
.weather-metric {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid rgba(243,247,247,.18);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
}
.weather-metric-primary {
  background: rgba(255,255,255,.065);
  border-color: rgba(243,247,247,.32);
}
.weather-metric-icon,
.weather-card .weather-metric-icon {
  width: 32px !important;
  height: 32px !important;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(243,247,247,.22);
  background: rgba(0,0,0,.16);
  font-size: 1.05rem !important;
  line-height: 1;
  margin: 0 !important;
}
.weather-metric strong {
  display: block;
  color: #f3f7f7;
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  line-height: 1;
  letter-spacing: -.03em;
  white-space: nowrap;
}
.weather-metric strong small {
  font-size: .58em;
  color: var(--muted);
  letter-spacing: 0;
}
.weather-metric em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
  font-style: normal;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.weather-card [data-weather-detail] {
  margin: 0 !important;
  font-size: .74rem !important;
  line-height: 1.2;
}
.weather-icon,
.weather-main,
.weather-state {
  display: none !important;
}
.futurised-card {
  height: 298px !important;
}
.news-list {
  scroll-behavior: smooth;
}
.account-control,
.org-switcher.account-control {
  min-height: 32px !important;
  padding: 6px 11px !important;
  font-size: 12px !important;
}
.topbar {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}
@media (max-width: 1100px) {
  .weather-card { height: auto !important; min-height: 190px !important; }
  .futurised-card { height: auto !important; min-height: 260px !important; }
}
@media (max-width: 760px) {
  .portal-app-tile,
  a.portal-app-tile {
    grid-template-columns: 58px minmax(0, 1fr) !important;
  }
  .weather-card { min-height: 0 !important; }
  .weather-metrics { grid-template-columns: 1fr; }
  .weather-metric { grid-template-columns: 36px minmax(0, 1fr); }
  .weather-metric-icon,
  .weather-card .weather-metric-icon { width: 36px !important; height: 36px !important; }
  .weather-title-line h2 { font-size: 1.4rem !important; }
  .account-control,
  .org-switcher.account-control { min-height: 36px !important; }
}

/* Dashboard v5: compact welcome panel, tighter weather/update stack and aligned news column. */
.dashboard-hero {
  grid-template-columns: minmax(0, 1fr) 170px !important;
  gap: 18px !important;
  margin: 16px 0 16px !important;
  padding: 20px 24px !important;
  min-height: 0 !important;
  border-radius: 24px !important;
}
.dashboard-hero .hero-copy h1 {
  margin-bottom: 6px !important;
  font-size: clamp(1.7rem, 3.8vw, 3rem) !important;
  line-height: 1 !important;
}
.dashboard-hero .hero-copy p {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  line-height: 1.35 !important;
}
.dashboard-hero .eyebrow { margin-bottom: 5px !important; }
.hero-logo-motion {
  min-height: 96px !important;
  height: 110px !important;
}
.hero-logo-motion img {
  max-width: 118px !important;
  max-height: 118px !important;
}

.dashboard-grid {
  row-gap: 12px !important;
  column-gap: 18px !important;
  grid-template-rows: 190px 332px !important;
}
.weather-card {
  height: 190px !important;
  min-height: 0 !important;
  padding: 13px 16px !important;
  gap: 7px !important;
}
.weather-title-line { align-items: center !important; }
.weather-title-line h2 {
  font-size: clamp(1.15rem, 1.7vw, 1.45rem) !important;
  line-height: 1 !important;
}
.weather-location {
  margin-top: -2px !important;
  font-size: .82rem !important;
  line-height: 1.05 !important;
}
.weather-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 7px !important;
}
.weather-metric {
  padding: 7px 7px !important;
  gap: 7px !important;
  border-radius: 14px !important;
}
.weather-metric-icon,
.weather-card .weather-metric-icon {
  width: 29px !important;
  height: 29px !important;
  border-radius: 10px !important;
  font-size: .98rem !important;
}
.weather-metric strong { font-size: clamp(.95rem, 1.9vw, 1.26rem) !important; }
.weather-metric em { font-size: .68rem !important; margin-top: 2px !important; }
.weather-card [data-weather-detail] { display: none !important; }

.futurised-card {
  height: 332px !important;
  min-height: 0 !important;
  padding: 16px 18px !important;
}
.futurised-news-strip {
  gap: 11px !important;
  margin-top: 8px !important;
}
.futurised-news-item {
  min-height: 104px !important;
  padding: 10px !important;
  grid-template-columns: 98px minmax(0, 1fr) !important;
}
.futurised-news-image { min-height: 84px !important; }
.futurised-news-item p { -webkit-line-clamp: 3 !important; }
.news-card {
  height: 534px !important;
  min-height: 534px !important;
}
.news-list { max-height: 438px !important; }

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-rows: auto !important; row-gap: 16px !important; }
  .weather-card,
  .futurised-card,
  .news-card { height: auto !important; }
  .weather-card { min-height: 170px !important; }
  .futurised-card { min-height: 270px !important; }
  .news-card { min-height: 500px !important; }
}
@media (max-width: 760px) {
  .dashboard-hero {
    grid-template-columns: 1fr !important;
    padding: 16px !important;
    gap: 10px !important;
  }
  .hero-logo-motion { min-height: 72px !important; height: 82px !important; }
  .hero-logo-motion img { max-width: 86px !important; max-height: 86px !important; }
  .weather-metrics { grid-template-columns: 1fr !important; }
  .weather-card { min-height: 260px !important; }
  .news-card { min-height: 560px !important; }
}


/* Dashboard v6: SensorPortal header, compact weather/update stack and language support. */
#google_translate_element,
.goog-te-banner-frame,
.goog-te-gadget,
.goog-te-balloon-frame,
body > .skiptranslate { display: none !important; }
html { top: 0 !important; }
.language-select { width: 100%; }
.topbar {
  margin: 14px auto 0 !important;
  width: min(1180px, calc(100% - 28px)) !important;
  border: 2px solid rgba(243,247,247,.88) !important;
  border-radius: 0 !important;
  background: linear-gradient(135deg, rgba(12,42,45,.98), rgba(15,18,19,.98)) !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.04) !important;
  padding: 10px 14px !important;
}
.brand, .topnav a, .account-control {
  color: #f3f7f7 !important;
}
.brand-logo {
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
}
.topnav a, .account-control {
  border: 1px solid rgba(243,247,247,.2) !important;
  background: rgba(255,255,255,.035) !important;
  border-radius: 12px !important;
  min-height: 34px !important;
  padding: 7px 12px !important;
  font-size: .82rem !important;
  font-weight: 800 !important;
}
.topnav a:hover, .topnav a:focus-visible, .account-control:hover, .account-control:focus-visible {
  background: rgba(243,247,247,.12) !important;
  border-color: rgba(243,247,247,.58) !important;
  color: #fff !important;
  text-decoration: none !important;
}
.dashboard-hero {
  padding: 14px 20px !important;
  grid-template-columns: minmax(0, 1fr) 132px !important;
}
.dashboard-hero .hero-copy h1 { font-size: clamp(1.5rem, 3vw, 2.45rem) !important; }
.dashboard-hero .hero-copy p { font-size: .9rem !important; }
.hero-logo-motion { height: 78px !important; min-height: 78px !important; }
.hero-logo-motion::before, .hero-logo-motion::after { inset: 10px !important; border-radius: 20px !important; }
.hero-logo-motion img { max-width: 82px !important; max-height: 82px !important; }
.dashboard-grid {
  grid-template-rows: 152px 352px !important;
  row-gap: 12px !important;
  align-items: stretch !important;
}
.weather-card {
  height: 152px !important;
  padding: 12px 16px !important;
  gap: 8px !important;
  overflow: hidden !important;
}
.weather-title-line {
  min-height: 34px !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}
.weather-title-line .card-kicker,
.weather-card .card-kicker {
  color: var(--muted) !important;
  font-size: .72rem !important;
  letter-spacing: .12em !important;
  text-transform: uppercase !important;
  max-width: 220px !important;
}
.weather-title-line h2 {
  font-size: clamp(1.05rem, 1.55vw, 1.28rem) !important;
}
.weather-location { display: none !important; }
.weather-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 7px !important;
}
.weather-metric {
  min-height: 58px !important;
  padding: 7px !important;
  border-radius: 13px !important;
}
.weather-metric-icon,
.weather-card .weather-metric-icon {
  width: 28px !important;
  height: 28px !important;
  font-size: .95rem !important;
}
.weather-metric strong { font-size: clamp(.9rem, 1.6vw, 1.12rem) !important; }
.weather-metric em { font-size: .64rem !important; }
.weather-card [data-weather-detail] { display: none !important; }
.futurised-card {
  height: 352px !important;
  min-height: 0 !important;
  padding: 16px 18px !important;
}
.news-card {
  height: 516px !important;
  min-height: 516px !important;
}
.news-list {
  position: relative !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
  max-height: none !important;
  padding-right: 0 !important;
}
.news-page {
  display: none !important;
  height: 100% !important;
  min-height: 0 !important;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
}
.news-page.is-active {
  display: grid !important;
  opacity: 1;
  transform: translateY(0);
}
.futurised-news-strip { height: calc(100% - 52px) !important; align-content: stretch !important; }
.futurised-news-item { min-height: 0 !important; }
.apps-heading-top .muted:empty { display: none !important; }
@media (max-width: 1100px) {
  .topbar { width: calc(100% - 24px) !important; }
  .dashboard-grid { grid-template-rows: auto !important; }
  .weather-card, .futurised-card, .news-card { height: auto !important; }
  .weather-card { min-height: 145px !important; }
  .futurised-card { min-height: 260px !important; }
  .news-card { min-height: 480px !important; }
  .news-list { min-height: 390px !important; }
}
@media (max-width: 760px) {
  .topbar { margin-top: 10px !important; padding: 10px !important; }
  .mobile-menu-toggle { border-color: rgba(243,247,247,.48) !important; }
  .dashboard-hero { grid-template-columns: 1fr !important; padding: 14px 16px !important; }
  .hero-logo-motion { height: 64px !important; min-height: 64px !important; }
  .weather-card { min-height: 245px !important; }
  .weather-metrics { grid-template-columns: 1fr !important; }
  .news-card { min-height: 560px !important; }
  .news-list { min-height: 460px !important; }
  .news-page { grid-template-columns: 1fr !important; grid-template-rows: repeat(4, minmax(0, 1fr)) !important; }
}

/* Dashboard v7: align header, menu and control look/feel with SensorPortal source. */
.topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 14px 24px !important;
  min-height: 58px !important;
  background: #000 !important;
  color: #f3f7f7 !important;
  border: 0 !important;
  border-bottom: 2px solid #f3f7f7 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.topbar a,
.topbar .brand,
.topbar .brand:visited,
.topbar .topnav a,
.topbar .topnav a:visited {
  color: #f3f7f7 !important;
  text-decoration: none !important;
}
.topbar a:hover,
.topbar .topnav a:hover,
.topbar .topnav a:focus-visible {
  color: #fff !important;
  text-decoration: none !important;
}
.brand {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  margin-right: 14px !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  letter-spacing: .02em !important;
  padding: 0 !important;
}
.brand-logo {
  width: 30px !important;
  height: 30px !important;
  object-fit: contain !important;
  display: inline-block !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.brand-text {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.topnav {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  min-width: 0 !important;
}
.nav-main {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  min-width: 0 !important;
  flex-wrap: wrap !important;
}
.nav-main > a,
.nav-main .nav-drop-button {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 0 !important;
  margin: 0 14px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #f3f7f7 !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  box-shadow: none !important;
}
.nav-main > a:hover,
.nav-main > a:focus-visible,
.nav-main .nav-drop-button:hover,
.nav-main .nav-drop-button:focus-visible {
  background: transparent !important;
  color: #fff !important;
  text-decoration: none !important;
  outline: 0 !important;
}
.nav-account {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-left: auto !important;
  flex: 0 0 auto !important;
}
.nav-account .logout-form { display: inline-flex !important; margin: 0 !important; }
.account-control,
.org-switcher.account-control {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 8px 13px !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 999px !important;
  background: #050708 !important;
  color: #f3f7f7 !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
}
.account-control:hover,
.account-control:focus-visible,
.org-switcher.account-control:hover,
.org-switcher.account-control:focus-visible {
  background: #f3f7f7 !important;
  color: #050708 !important;
  border-color: #f3f7f7 !important;
  outline: 0 !important;
  text-decoration: none !important;
}
.mobile-menu-toggle {
  display: none;
  width: 44px !important;
  height: 40px !important;
  min-width: 44px !important;
  padding: 0 !important;
  margin-left: auto !important;
  border: 1px solid rgba(243,247,247,.28) !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,.06) !important;
  color: #f3f7f7 !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  gap: 5px !important;
}
.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus-visible {
  background: rgba(255,255,255,.12) !important;
  color: #f3f7f7 !important;
}
.mobile-menu-toggle span {
  display: block !important;
  width: 20px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: currentColor !important;
  transition: transform .16s ease, opacity .16s ease !important;
}
@media (max-width: 900px) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }
  .mobile-menu-toggle { display: inline-flex !important; }
  .topbar .brand { min-width: 0 !important; margin-right: 0 !important; }
  .topbar .brand-text { max-width: calc(100vw - 92px) !important; }
  .topbar .topnav {
    grid-column: 1 / -1 !important;
    display: none !important;
    width: 100% !important;
    margin-top: 4px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(243,247,247,.16) !important;
  }
  .topbar.mobile-menu-open .topnav,
  .topnav.is-open {
    display: grid !important;
    gap: 12px !important;
  }
  .topbar .nav-main,
  .topbar .nav-account {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    margin-left: 0 !important;
  }
  .topbar .nav-main > a,
  .topbar .nav-main .nav-drop-button,
  .topbar .nav-account .account-control {
    width: 100% !important;
    min-height: 38px !important;
    justify-content: flex-start !important;
    text-align: left !important;
    padding: 8px 12px !important;
    border: 1px solid rgba(243,247,247,.18) !important;
    border-radius: 10px !important;
    background: rgba(255,255,255,.035) !important;
  }
  .topbar .nav-main > a:hover,
  .topbar .nav-main .nav-drop-button:hover,
  .topbar .nav-account .account-control:hover {
    background: #f3f7f7 !important;
    color: #050708 !important;
    border-color: #f3f7f7 !important;
  }
}

/* Dashboard v8: news scrollbar, unified widget headers and getfuturised SSO launch polish. */
.weather-card .card-header-line,
.futurised-card .card-header-line,
.news-card .card-header-line {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 14px !important;
  min-height: 44px !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
}
.weather-card .card-header-line > div,
.futurised-card .card-header-line > div,
.news-card .card-header-line > div {
  display: grid !important;
  gap: 4px !important;
  min-width: 0 !important;
}
.weather-card .card-kicker,
.futurised-card .card-kicker,
.news-card .card-kicker,
.weather-title-line .card-kicker {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  letter-spacing: .14em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}
.weather-card .card-header-line h2,
.futurised-card .card-header-line h2,
.news-card .card-header-line h2,
.weather-title-line h2 {
  margin: 0 !important;
  color: #f3f7f7 !important;
  font-size: clamp(1.05rem, 1.55vw, 1.28rem) !important;
  font-weight: 850 !important;
  line-height: 1.12 !important;
  letter-spacing: -.015em !important;
}
.weather-card {
  height: auto !important;
  min-height: 0 !important;
  padding-bottom: 12px !important;
}
.weather-metrics { margin-top: 0 !important; }
.news-list {
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  scrollbar-gutter: stable !important;
  padding-right: 8px !important;
}
.news-list::-webkit-scrollbar { width: 8px !important; }
.news-list::-webkit-scrollbar-thumb { background: rgba(243,247,247,.28) !important; border-radius: 999px !important; }
.news-list::-webkit-scrollbar-track { background: rgba(255,255,255,.05) !important; border-radius: 999px !important; }
.news-page.is-active { display: grid !important; }
.portal-app-tile[data-sso="true"] { position: relative; }
@media (max-width: 760px) {
  .weather-card .card-header-line,
  .futurised-card .card-header-line,
  .news-card .card-header-line { min-height: 40px !important; margin-bottom: 10px !important; }
  .news-list { padding-right: 4px !important; }
}


/* Dashboard v9: true scrolling news list and identical widget header rhythm. */
.weather-card .card-header-line,
.futurised-card .card-header-line,
.news-card .card-header-line,
.weather-card .weather-title-line {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 14px !important;
  min-height: 44px !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
}
.weather-card .card-header-line > div,
.futurised-card .card-header-line > div,
.news-card .card-header-line > div,
.weather-card .weather-title-line > div {
  display: grid !important;
  gap: 4px !important;
  min-width: 0 !important;
}
.weather-card .card-kicker,
.futurised-card .card-kicker,
.news-card .card-kicker,
.weather-card .weather-title-line .card-kicker {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  letter-spacing: .14em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}
.weather-card .card-header-line h2,
.futurised-card .card-header-line h2,
.news-card .card-header-line h2,
.weather-card .weather-title-line h2 {
  margin: 0 !important;
  color: #f3f7f7 !important;
  font-size: clamp(1.05rem, 1.55vw, 1.28rem) !important;
  font-weight: 850 !important;
  line-height: 1.12 !important;
  letter-spacing: -.015em !important;
}
.dashboard-card.weather-card,
.dashboard-card.futurised-card,
.dashboard-card.news-card {
  display: flex !important;
  flex-direction: column !important;
}
.weather-card { height: auto !important; min-height: 0 !important; }
.weather-metrics { flex: 0 0 auto !important; margin-top: 0 !important; }
.news-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  align-content: start !important;
  gap: 12px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth !important;
  scrollbar-gutter: stable !important;
  padding-right: 8px !important;
  min-height: 0 !important;
  max-height: none !important;
}
.news-list .news-page { display: contents !important; }
.news-list .news-item {
  display: grid !important;
  grid-template-columns: 118px minmax(0, 1fr) !important;
  min-height: 88px !important;
}
.news-list::-webkit-scrollbar { width: 8px !important; }
.news-list::-webkit-scrollbar-thumb { background: rgba(243,247,247,.28) !important; border-radius: 999px !important; }
.news-list::-webkit-scrollbar-track { background: rgba(255,255,255,.05) !important; border-radius: 999px !important; }
.futurised-card { overflow: hidden !important; }
.futurised-news-strip { flex: 1 1 auto !important; min-height: 0 !important; }
@media (min-width: 1101px) {
  .dashboard-grid { grid-template-rows: auto 1fr !important; }
  .news-card { height: 516px !important; min-height: 516px !important; }
  .news-list { height: calc(516px - 78px) !important; }
  .weather-card { height: 152px !important; }
  .futurised-card { height: 352px !important; }
}
@media (max-width: 760px) {
  .news-list .news-item { grid-template-columns: 1fr !important; }
  .news-list { padding-right: 4px !important; }
}

/* Dashboard v10: restore Actueel nieuws as image tiles and force white app-tile text. */
.news-card .news-list {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: start !important;
  gap: 12px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth !important;
  scrollbar-gutter: stable !important;
  padding-right: 8px !important;
  min-height: 0 !important;
  max-height: none !important;
}
.news-card .news-list .news-page { display: contents !important; }
.news-card .news-list .news-item,
.news-card a.news-item {
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: 128px minmax(0, 1fr) !important;
  min-height: 246px !important;
  height: auto !important;
  padding: 10px !important;
  gap: 10px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(243,247,247,.18) !important;
  background: rgba(255,255,255,.045) !important;
  color: #f3f7f7 !important;
  text-decoration: none !important;
  scroll-snap-align: start !important;
}
.news-card .news-list .news-item:hover,
.news-card a.news-item:hover,
.news-card .news-list .news-item:focus-visible,
.news-card a.news-item:focus-visible {
  border-color: rgba(243,247,247,.54) !important;
  background: rgba(255,255,255,.075) !important;
  transform: translateY(-1px) !important;
  text-decoration: none !important;
}
.news-card .news-thumb {
  display: block !important;
  width: 100% !important;
  min-height: 0 !important;
  height: 128px !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: rgba(243,247,247,.08) !important;
  border: 1px solid rgba(243,247,247,.10) !important;
}
.news-card .news-thumb img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.news-card .news-copy { display: block !important; min-width: 0 !important; }
.news-card .news-item strong {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  color: #f3f7f7 !important;
  font-size: .94rem !important;
  line-height: 1.18 !important;
  margin: 0 0 7px !important;
}
.news-card .news-item p {
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  margin: 0 !important;
  color: #b7c7ca !important;
  font-size: .81rem !important;
  line-height: 1.35 !important;
}
.portal-app-tile,
a.portal-app-tile,
.portal-app-tile *,
a.portal-app-tile *,
.portal-app-tile h2,
a.portal-app-tile h2,
.portal-tile-content,
.portal-tile-content h2,
.portal-tile-content span,
.portal-tile-content strong {
  color: #f3f7f7 !important;
}
.portal-app-tile .muted,
a.portal-app-tile .muted,
.portal-app-tile .small,
a.portal-app-tile .small {
  color: #f3f7f7 !important;
  opacity: .82 !important;
}
@media (min-width: 1101px) {
  .news-card { height: 516px !important; min-height: 516px !important; }
  .news-card .news-list { height: calc(516px - 78px) !important; }
}
@media (max-width: 760px) {
  .news-card .news-list { grid-template-columns: 1fr !important; padding-right: 4px !important; }
  .news-card .news-list .news-item,
  .news-card a.news-item {
    grid-template-rows: 150px minmax(0, 1fr) !important;
    min-height: 270px !important;
  }
  .news-card .news-thumb { height: 150px !important; }
}

/* Dashboard v11: show four news tiles fully, align Futurised Updates, white application icon text. */
@media (min-width: 1101px) {
  .dashboard-grid {
    grid-template-columns: minmax(260px, .82fr) minmax(0, 1.38fr) !important;
    grid-template-rows: 218px 376px !important;
    gap: 18px !important;
    align-items: stretch !important;
  }
  .weather-card {
    height: 218px !important;
    min-height: 218px !important;
    grid-row: 1 !important;
  }
  .futurised-card {
    height: 376px !important;
    min-height: 376px !important;
    grid-row: 2 !important;
  }
  .news-card {
    height: 612px !important;
    min-height: 612px !important;
    grid-row: 1 / span 2 !important;
  }
  .news-card .news-list {
    height: calc(612px - 78px) !important;
    min-height: calc(612px - 78px) !important;
    max-height: calc(612px - 78px) !important;
  }
  .news-card .news-list .news-item,
  .news-card a.news-item {
    min-height: 250px !important;
  }
  .futurised-card .futurised-news-strip {
    height: calc(100% - 52px) !important;
    align-content: stretch !important;
  }
  .futurised-card .futurised-news-item {
    min-height: 0 !important;
  }
}
.portal-app-tile .portal-tile-logo-wrap,
.portal-app-tile .portal-tile-logo-wrap *,
a.portal-app-tile .portal-tile-logo-wrap,
a.portal-app-tile .portal-tile-logo-wrap *,
.portal-app-tile .portal-tile-icon,
a.portal-app-tile .portal-tile-icon,
.portal-app-tile .portal-tile-content,
.portal-app-tile .portal-tile-content *,
a.portal-app-tile .portal-tile-content,
a.portal-app-tile .portal-tile-content * {
  color: #f3f7f7 !important;
  -webkit-text-fill-color: #f3f7f7 !important;
  text-shadow: none !important;
}
.portal-app-tile .portal-tile-logo-wrap svg,
a.portal-app-tile .portal-tile-logo-wrap svg,
.portal-app-tile .portal-tile-icon svg,
a.portal-app-tile .portal-tile-icon svg {
  color: #f3f7f7 !important;
  fill: currentColor !important;
  stroke: currentColor !important;
}
@media (max-width: 1100px) {
  .news-card .news-list {
    max-height: 560px !important;
  }
}

/* Dashboard v12: compact weather card, let Futurised Updates fill to align with Actueel nieuws. */
.goog-te-banner-frame,
.goog-te-gadget-icon,
#google_translate_element { display: none !important; }
body { top: 0 !important; }
.skiptranslate { display: none !important; }
body > .skiptranslate { display: none !important; }

@media (min-width: 1101px) {
  .dashboard-grid {
    grid-template-columns: minmax(260px, .82fr) minmax(0, 1.38fr) !important;
    grid-template-rows: 142px 458px !important;
    gap: 12px 18px !important;
    align-items: stretch !important;
  }
  .weather-card {
    height: 142px !important;
    min-height: 142px !important;
    padding: 14px 16px !important;
    grid-row: 1 !important;
  }
  .weather-card .card-header-line,
  .weather-card .weather-title-line {
    min-height: 34px !important;
    margin-bottom: 8px !important;
    gap: 10px !important;
  }
  .weather-card .card-kicker,
  .weather-card .weather-title-line .card-kicker {
    font-size: .68rem !important;
    line-height: 1 !important;
  }
  .weather-card .card-header-line h2,
  .weather-card .weather-title-line h2 {
    font-size: 1.03rem !important;
    line-height: 1.08 !important;
  }
  .weather-metrics {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  .weather-card .weather-metric {
    min-height: 54px !important;
    padding: 8px !important;
    gap: 8px !important;
  }
  .weather-card .weather-metric-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 1.05rem !important;
  }
  .weather-card .weather-metric strong {
    font-size: .98rem !important;
    line-height: 1 !important;
  }
  .weather-card .weather-metric em {
    font-size: .66rem !important;
    line-height: 1.05 !important;
  }
  .weather-card [data-weather-detail] {
    display: none !important;
  }
  .futurised-card {
    height: 458px !important;
    min-height: 458px !important;
    grid-row: 2 !important;
  }
  .futurised-card .futurised-news-strip {
    height: calc(100% - 52px) !important;
    min-height: 0 !important;
  }
  .news-card {
    height: 612px !important;
    min-height: 612px !important;
    grid-row: 1 / span 2 !important;
  }
  .news-card .news-list {
    height: calc(612px - 78px) !important;
    min-height: calc(612px - 78px) !important;
    max-height: calc(612px - 78px) !important;
  }
}
@media (max-width: 1100px) {
  .weather-card {
    min-height: 0 !important;
  }
  .weather-card [data-weather-detail] {
    margin-bottom: 0 !important;
  }
}


/* Dashboard v14: restore stable Actueel Nieuws tile layout and keep Google widget hidden. */
#google_translate_element { display: none !important; }
.goog-te-banner-frame,
.goog-te-gadget-icon,
.skiptranslate,
body > .skiptranslate { display: none !important; }
html.translated-ltr body,
html.translated-rtl body,
body { top: 0 !important; }

.news-card {
  position: relative !important;
  overflow: hidden !important;
}
.news-card .card-header-line {
  position: relative !important;
  z-index: 1 !important;
  pointer-events: auto !important;
}
.news-card .news-list {
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-content: start !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-gutter: stable !important;
  padding: 0 6px 0 0 !important;
  scroll-behavior: smooth !important;
}
.news-card .news-list::-webkit-scrollbar { width: 8px !important; }
.news-card .news-list::-webkit-scrollbar-thumb { background: rgba(243,247,247,.34) !important; border-radius: 999px !important; }
.news-card .news-list::-webkit-scrollbar-track { background: rgba(255,255,255,.06) !important; border-radius: 999px !important; }
.news-card .news-item,
.news-card a.news-item {
  display: grid !important;
  grid-template-rows: 112px minmax(0, 1fr) !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  min-height: 250px !important;
  padding: 10px !important;
  text-decoration: none !important;
}
.news-card .news-thumb {
  width: 100% !important;
  height: 112px !important;
  min-height: 112px !important;
  border-radius: 14px !important;
  overflow: hidden !important;
}
.news-card .news-thumb img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.news-card .news-copy { display: block !important; min-width: 0 !important; }
.news-card .news-item strong {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  color: #f3f7f7 !important;
  font-size: .94rem !important;
  line-height: 1.18 !important;
  margin: 0 0 7px !important;
}
.news-card .news-item p {
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  margin: 0 !important;
  color: #b7c7ca !important;
  font-size: .81rem !important;
  line-height: 1.35 !important;
}
@media (min-width: 1101px) {
  .news-card { height: 612px !important; min-height: 612px !important; padding: 16px !important; }
  .news-card .news-list {
    height: calc(612px - 78px) !important;
    min-height: calc(612px - 78px) !important;
    max-height: calc(612px - 78px) !important;
  }
}
@media (max-width: 760px) {
  .news-card .news-list { grid-template-columns: 1fr !important; padding-right: 4px !important; }
  .news-card .news-item,
  .news-card a.news-item {
    grid-template-rows: 150px minmax(0, 1fr) !important;
    min-height: 270px !important;
  }
  .news-card .news-thumb { height: 150px !important; min-height: 150px !important; }
}


/* Dashboard v15: block page display until the selected language has been applied. */
body.frdp-i18n-pending {
  overflow: hidden !important;
}
body.frdp-i18n-pending .topbar,
body.frdp-i18n-pending main.container,
body.frdp-i18n-pending .settings-backdrop {
  visibility: hidden !important;
  pointer-events: none !important;
}
.portal-translation-loader[hidden] {
  display: none !important;
}
.portal-translation-loader {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100vh !important;
  padding: 24px !important;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.08), transparent 34%), #000 !important;
  color: #f3f7f7 !important;
}
.portal-translation-loader-card {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  min-width: min(420px, 100%) !important;
  padding: 20px 22px !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 0 !important;
  background: rgba(10, 14, 16, .94) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.45) !important;
}
.portal-translation-loader-card strong {
  display: block !important;
  margin: 0 0 3px !important;
  color: #fff !important;
  font-size: 1rem !important;
  line-height: 1.1 !important;
  letter-spacing: .01em !important;
}
.portal-translation-loader-card span {
  display: block !important;
  color: #b7c7ca !important;
  font-size: .86rem !important;
  line-height: 1.35 !important;
}
.portal-translation-spinner {
  width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px !important;
  border: 2px solid rgba(255,255,255,.22) !important;
  border-top-color: #fff !important;
  border-radius: 50% !important;
  animation: portalTranslationSpin .8s linear infinite !important;
}
@keyframes portalTranslationSpin {
  to { transform: rotate(360deg); }
}
@media (max-width: 560px) {
  .portal-translation-loader-card {
    min-width: 0 !important;
    width: 100% !important;
    padding: 18px !important;
  }
}
