@font-face {
  font-family: AIST Mono;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: AIST Mono;
  src: url("fonts/ibm-plex-mono-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: AIST Mono;
  src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: AIST Mono;
  src: url("fonts/ibm-plex-mono-cyrillic-600-normal.woff2") format("woff2");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
:root {
  color-scheme: light;
  --bg: #fbfbfc;
  --panel: #fff;
  --line: #e3e6ea;
  --muted: #657080;
  --ink: #171b22;
  --accent: #075c70;
  --danger: #aa2638;
  font:
    14px/1.55 "AIST Mono",
    ui-monospace,
    "SFMono-Regular",
    Menlo,
    Consolas,
    monospace;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button,
a,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: #f0f3f5;
  border-color: #b9c6d1;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.danger {
  color: var(--danger);
}
button.active {
  background: #ecf3f5;
  color: var(--accent);
  border-color: #b2ccd3;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
article:focus-visible {
  outline: 3px solid #257b96;
  outline-offset: 3px;
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.icon-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 10px;
}
header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 10px 3vw;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -1.1px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand span {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.3px;
  margin-left: 12px;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 6px;
}
#nav {
  flex: 1;
  align-self: stretch;
}
.nav-item {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  padding: 12px;
  color: var(--muted);
  position: relative;
  background: transparent;
  white-space: nowrap;
}
.nav-item.active {
  color: var(--accent);
  background: transparent;
}
.nav-item.active:after {
  content: "";
  position: absolute;
  height: 2px;
  bottom: -10px;
  left: 12px;
  right: 12px;
  background: var(--accent);
}
#identity {
  display: flex;
  align-items: center;
  gap: 12px;
}
.username {
  font-size: 12px;
  color: var(--muted);
}
#mobile-nav {
  display: none;
}
main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 36px 3vw 48px;
}
h1 {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -1.2px;
  margin: 0 0 18px;
}
h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 18px;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
p {
  margin: 12px 0;
}
small,
.muted {
  color: var(--muted);
}
.good {
  color: #087344;
}
.bad {
  color: var(--danger);
}
.right {
  margin-left: auto;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  min-height: 44px;
  color: var(--ink);
  background: #fff;
  width: 100%;
  min-width: 0;
}
input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin-right: 10px;
}
select[multiple] {
  min-height: 120px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  align-items: end;
}
.fields .full {
  grid-column: 1/-1;
}
.fields button {
  align-self: end;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 22px;
}
.login {
  max-width: 460px;
  margin: 7vh auto;
  padding: 34px;
}
.login form {
  display: grid;
  gap: 20px;
}
.login h1 {
  font-size: 25px;
}
.login p {
  font-size: 13px;
}
.login button.primary {
  margin-top: 6px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.toolbar button {
  background: transparent;
}
.scroll {
  overflow: auto;
  max-width: 100%;
  overscroll-behavior-inline: contain;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th,
td {
  padding: 15px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-weight: 400;
  color: var(--muted);
}
td button {
  font-size: 11px;
  padding: 8px 10px;
  margin: 3px;
  min-height: 38px;
}
td small {
  display: block;
}
.tag {
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
}
.amount {
  font-size: 28px;
  font-weight: 600;
}
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
details {
  margin: 14px 0;
}
summary {
  cursor: pointer;
  color: var(--accent);
  min-height: 44px;
  padding: 8px 0;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  max-width: 680px;
  width: 94%;
  padding: 26px;
  box-shadow: 0 24px 80px #101c3033;
}
dialog::backdrop {
  background: #15223766;
}
dialog pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.panel pre {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
#notice {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  background: #17222c;
  color: #fff;
  border: 1px solid #344454;
  padding: 14px 22px;
  border-radius: 9px;
  display: none;
  z-index: 100;
  box-shadow: 0 4px 20px #0c1b2920;
}
#notice.error {
  background: #7c2633;
  border-color: #7c2633;
}
footer {
  text-align: center;
  padding: 22px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}
.wall-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 22px;
}
.wall-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.wall-summary {
  font-size: 12px;
  color: var(--muted);
}
.wall-summary:before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 9px;
}
.capacity-hint {
  font-size: 10px;
  color: var(--muted);
}
.wall-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}
.search-wrap {
  position: relative;
  width: 210px;
}
.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.camera-search {
  padding-left: 37px;
  background: #f6f7f9;
  font-size: 12px;
}
.group-filter {
  width: 154px;
  font-size: 12px;
}
.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  background: #fff;
}
.segmented button {
  border: 0;
  border-radius: 0;
  min-width: 37px;
  padding: 8px;
  font-size: 12px;
  min-height: 42px;
}
.segmented button.active {
  background: var(--accent);
  color: #fff;
}
.wall-start,
.wall-stop {
  font-size: 11px;
  padding: 8px 10px;
}
.camera-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.camera-wall[data-layout="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.camera-wall[data-layout="9"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.camera-wall[data-layout="1"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.camera-wall[data-layout="1"] > .selected {
  grid-column: 1/-1;
  max-width: 1160px;
  width: 100%;
  justify-self: center;
}
.camera {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}
.camera.selected {
  border-color: #81abb8;
  box-shadow: 0 0 0 1px #81abb81c;
}
.video-stage {
  position: relative;
  aspect-ratio: 16/9;
  background: #f0f2f4;
  overflow: hidden;
  cursor: pointer;
}
.video-stage video,
.poster,
.video-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.video-stage video {
  opacity: 0;
  display: block;
  background: transparent;
}
.poster {
  object-fit: cover;
}
.video-placeholder {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  align-items: center;
  background: #f0f2f4;
  color: #a7afb9;
}
.video-placeholder svg {
  width: 36px;
  height: 36px;
  stroke-width: 1;
}
.video-placeholder span {
  font-size: 11px;
  letter-spacing: 3px;
}
.camera[data-playback="playing"] video,
.camera[data-playback="ready"] video {
  opacity: 1;
}
.camera[data-playback="playing"] .poster {
  visibility: hidden;
}
.camera-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 5px 14px;
}
.camera-name {
  border: 0;
  background: transparent !important;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  white-space: nowrap;
  max-width: 75%;
}
.stream-badge {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  display: flex;
  gap: 7px;
  align-items: center;
}
.stream-badge:before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa3ae;
  flex-shrink: 0;
}
.stream-badge[data-state="online"]:before {
  background: #19b773;
}
.stream-badge[data-state="unavailable"]:before {
  background: #b96742;
}
.video-actions {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  gap: 5px;
  z-index: 3;
}
.video-actions button {
  background: #17212dd9;
  color: #fff;
  border: 1px solid #ffffff24;
  border-radius: 7px;
}
.stage-message {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 12px;
  color: #596a78;
  font-size: 11px;
  text-align: center;
}
.camera[data-playback="playing"] .stage-message {
  display: none;
}
.camera[data-playback="loading"] .stage-message {
  background: #f0f2f4e6;
}
.camera[data-playback="loading"] .stage-message:before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid #bdcdd2;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
  margin-right: 9px;
}
.camera-wall:fullscreen {
  padding: 16px;
  background: #fbfbfc;
  overflow: auto;
  align-content: center;
  min-height: 100%;
  width: 100%;
}
.video-stage:fullscreen {
  background: #000;
  aspect-ratio: auto;
}
.video-stage:fullscreen video {
  object-fit: contain;
}
.video-stage:fullscreen .camera-caption {
  display: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (hover: hover) {
  .camera[data-playback="playing"] .video-actions {
    opacity: 0;
    transition: opacity 0.2s;
  }
  .camera:hover .video-actions,
  .camera:focus-within .video-actions {
    opacity: 1;
  }
}
@media (min-width: 1600px) {
  main {
    padding-top: 42px;
  }
  .camera-wall {
    gap: 16px;
  }
  .camera-caption {
    min-height: 56px;
  }
  .camera-name {
    font-size: 15px;
  }
}
@media (max-width: 1200px) {
  header {
    gap: 18px;
    padding-inline: 24px;
  }
  .brand span {
    display: none;
  }
  .nav-item {
    padding-inline: 10px;
    font-size: 12px;
  }
  .wall-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .wall-tools {
    width: 100%;
  }
  .search-wrap {
    flex: 1;
  }
  .camera-name {
    font-size: 12px;
  }
  .stream-badge {
    font-size: 9px;
    gap: 4px;
  }
}
@media (max-width: 700px) {
  :root {
    font-size: 14px;
  }
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  header {
    padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
    min-height: 66px;
    gap: 10px;
    position: sticky;
  }
  .brand {
    font-size: 23px;
  }
  .brand span {
    display: inline;
    font-size: 11px;
    margin-left: 7px;
  }
  #nav {
    display: none;
  }
  #identity {
    margin-left: auto;
  }
  .username {
    display: none;
  }
  #mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    justify-content: space-around;
    gap: 0;
    border-top: 1px solid var(--line);
    background: #fffffff5;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    min-height: 68px;
  }
  .nav-item {
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    min-width: 60px;
    min-height: 52px;
    padding: 5px;
  }
  .nav-item svg {
    width: 21px;
    height: 21px;
  }
  .nav-item.active:after {
    display: none;
  }
  .nav-item.active {
    font-weight: 600;
  }
  main {
    padding: 24px 16px 32px;
  }
  h1 {
    font-size: 25px;
    letter-spacing: -0.8px;
    margin-bottom: 14px;
  }
  h2 {
    font-size: 16px;
  }
  .panel {
    padding: 18px;
    margin-bottom: 16px;
    border-radius: 9px;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .fields input,
  .fields select,
  .login input {
    font-size: 16px;
  }
  .login {
    padding: 24px;
    margin: 6vh 0;
  }
  .login h1 {
    font-size: 23px;
  }
  .toolbar {
    flex-wrap: nowrap;
    overflow: auto;
    padding-bottom: 8px;
    margin: 12px -16px 18px;
    padding-inline: 16px;
  }
  .toolbar button {
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
  }
  table {
    font-size: 12px;
  }
  td button {
    min-height: 44px;
  }
  .wall-toolbar {
    gap: 14px;
    margin-bottom: 16px;
  }
  .wall-caption {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }
  .wall-summary {
    font-size: 10px;
  }
  .capacity-hint {
    display: none;
  }
  .wall-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 126px;
    gap: 8px;
  }
  .search-wrap {
    width: auto;
  }
  .group-filter {
    width: 100%;
  }
  .segmented,
  .wall-start,
  .wall-stop,
  .wall-tools > .icon-button {
    display: none;
  }
  .camera-wall,
  .camera-wall[data-layout="1"],
  .camera-wall[data-layout="4"],
  .camera-wall[data-layout="9"] {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .camera {
    width: 100%;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    min-height: 78px;
    border-radius: 8px;
  }
  .camera .video-stage {
    width: 108px;
    align-self: stretch;
    aspect-ratio: auto;
    min-height: 78px;
  }
  .camera .video-placeholder {
    gap: 5px;
  }
  .camera .video-placeholder svg {
    width: 22px;
    height: 22px;
  }
  .camera .video-placeholder span {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .camera .stage-message,
  .camera .video-actions {
    display: none;
  }
  .camera-caption {
    padding: 9px 12px;
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .camera-name {
    font-size: 12px;
    max-width: 100%;
    min-height: 25px;
    padding: 0;
    white-space: normal;
    line-height: 1.5;
  }
  .stream-badge {
    font-size: 10px;
  }
  .camera.selected {
    display: block;
    margin-bottom: 18px;
  }
  .camera.selected .video-stage {
    width: 100%;
    aspect-ratio: 16/9;
    min-height: 0;
  }
  .camera.selected .video-placeholder svg {
    width: 36px;
    height: 36px;
  }
  .camera.selected .video-placeholder span {
    font-size: 10px;
    letter-spacing: 3px;
  }
  .camera.selected .video-actions {
    display: flex;
    top: auto;
    bottom: 10px;
    left: auto;
    right: 10px;
  }
  .camera.selected .stage-message {
    display: flex;
    justify-content: flex-start;
    text-align: left;
    max-width: calc(100% - 115px);
    font-size: 10px;
    bottom: 9px;
    border-radius: 0 5px 5px 0;
    padding: 10px;
    color: var(--muted);
  }
  .camera.selected[data-playback="playing"] .stage-message {
    display: none;
  }
  .camera.selected .camera-caption {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 10px 13px;
    min-height: 53px;
  }
  .camera.selected .camera-name {
    font-size: 14px;
    max-width: 76%;
  }
  .camera-wall:fullscreen {
    padding: 10px;
  }
  .camera-wall:fullscreen > .camera:not(.selected) {
    display: none;
  }
  #notice {
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
    font-size: 12px;
    padding: 14px;
    max-width: 480px;
  }
  dialog {
    padding: 20px;
  }
  footer {
    font-size: 9px;
    padding: 18px 16px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 360px) {
  .brand span {
    display: none;
  }
  .wall-tools {
    grid-template-columns: 1fr;
  }
  .group-filter {
    display: none;
  }
  .camera.selected .camera-name {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.camera[data-playback="buffering"] video {
  opacity: 1;
}
.camera[data-playback="buffering"] .stage-message {
  color: white;
  background: #17212bcc;
}
@media (max-width: 700px) {
  .camera-search,
  .group-filter {
    font-size: 16px;
  }
  .wall-tools {
    grid-template-columns: minmax(0, 1fr) 140px;
  }
  .camera-name {
    min-height: 44px;
    font-size: 13px;
  }
  .camera.selected .camera-name {
    min-height: 44px;
  }
  .camera-caption {
    padding-block: 6px;
  }
}
