.controlButton {
  min-width: 64px;
  height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #8f2424;
  border: 1px solid #ff4d4d;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.controlButton.is-on {
  background: #16803c;
  border-color: #2ecc71;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.controlButton.is-off {
  background: #8f2424;
  border-color: #ff4d4d;
  box-shadow: none;
}

.controlButton.is-live {
  background: #0d6efd;
  border-color: #6ea8fe;
  box-shadow: 0 0 12px rgba(13, 110, 253, 0.55);
  animation: micPttPulse 1s ease-in-out infinite;
}

.controlButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.controlButton:disabled:hover {
  transform: none;
}

button[data-control="mic"] {
  touch-action: none;
  user-select: none;
}

@keyframes micPttPulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.45);
  }

  50% {
    box-shadow: 0 0 16px rgba(13, 110, 253, 0.75);
  }
}

.micPttStatus {
  font-size: 0.85rem;
  opacity: 0.9;
}

.micPttStatus.is-ready {
  color: #8b949e;
}

.micPttStatus.is-connecting {
  color: #d29922;
}

.micPttStatus.is-live {
  color: #58a6ff;
  font-weight: 600;
}

.micPttStatus.is-error {
  color: #f85149;
}

.controlButton:hover {
  transform: translateY(-1px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0d1117;
  color: white;
}

.topBar {
  position: relative;
  z-index: 10000;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

.topBar h1 {
  margin: 0;
  font-size: 25px;
}

.topBarActions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logoutButton {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  color: #ffffff;
  cursor: pointer;
}

.logoutButton:hover {
  background: #30363d;
}

.systemStatus {
  color: #35d07f;
  font-weight: bold;
}

.appLayout {
  display: flex;
  min-height: calc(100vh - 70px);
}

.sideNav {
  width: 220px;
  flex-shrink: 0;
  padding: 16px 12px;
  background: #161b22;
  border-right: 1px solid #30363d;
}

.sideNavTitle {
  margin: 0 10px 12px;
  color: #8b949e;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.navLink {
  display: block;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  color: #c9d1d9;
  text-decoration: none;
  font-size: 14px;
}

.navLink:hover {
  background: #21262d;
  color: #ffffff;
}

.navLink.is-active {
  background: #1f6feb33;
  color: #ffffff;
  border: 1px solid #2f81f7;
}

.navLink[hidden] {
  display: none !important;
}

.pageContent {
  flex: 1;
  min-width: 0;
  padding: 25px;
}

.dashboard {
  padding: 0;
}

.dashboardFilters {
  padding: 20px 25px 0;
}

.dashboardFilterToolbar {
  margin-bottom: 4px;
}

.dashboardFilterField {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #8b949e;
}

.dashboardFilterField select {
  min-width: 180px;
}

.cameraGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 20px 25px 25px;
}

.cameraCard {
  overflow: hidden;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #161b22;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.cameraHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: #1c2128;
}

.cameraTitle,
.cameraName {
  font-size: 18px;
  font-weight: bold;
}

.cameraScreen {
  position: relative;
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, #202833 0%, #0b0f14 70%);
}

.cameraPlaceholder {
  color: #74808c;
  font-size: 28px;
  letter-spacing: 2px;
  text-align: center;
  padding: 0 16px;
}

.cameraStream {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b0f14;
}

.cameraOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 22px;
  opacity: 0;
  background: linear-gradient(
    transparent 45%,
    rgba(0, 0, 0, 0.88)
  );
  transition: opacity 0.25s ease;
}

.cameraScreen:hover .cameraOverlay {
  opacity: 1;
}

.cameraScreen:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

.cameraScreen:fullscreen .cameraStream {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.cameraScreen:fullscreen .cameraOverlay {
  z-index: 10;
}

.loginScreen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0d1117;
}

.loginScreen:not([hidden]) {
  display: flex;
}

#loginScreen[hidden],
#appShell[hidden] {
  display: none !important;
}

.loginCard {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #161b22;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.loginCard h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.loginCard p {
  margin: 0 0 20px;
  color: #8b949e;
}

.loginField {
  margin-bottom: 16px;
}

.loginField label {
  display: block;
  margin-bottom: 6px;
  color: #8b949e;
  font-size: 14px;
}

.loginField input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #ffffff;
}

.loginSubmit {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 1px solid #2f81f7;
  border-radius: 8px;
  background: #238636;
  color: #ffffff;
  font-weight: bold;
  cursor: pointer;
}

.loginSubmit:hover {
  background: #2ea043;
}

.loginSubmit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.loginError {
  min-height: 20px;
  margin-top: 12px;
  color: #ff6464;
  font-size: 14px;
}

.statusGreen {
  color: #35d07f;
}

.statusRed {
  color: #ff6464;
}

.deviceInfo {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 15px;
  border-top: 1px solid #30363d;
  color: #8b949e;
  font-size: 13px;
}

.dashboardError,
.emptyDashboard,
.panelState {
  padding: 20px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #161b22;
  color: #8b949e;
  text-align: center;
}

.panelState.is-loading,
.panelState.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
}

.panelState.is-empty {
  color: #8b949e;
  border-style: dashed;
}

.stateSpinner {
  width: 18px;
  height: 18px;
  border: 2px solid #30363d;
  border-top-color: #2f81f7;
  border-radius: 50%;
  animation: adminSpin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes adminSpin {
  to {
    transform: rotate(360deg);
  }
}

.dashboardError,
.panelState.is-error {
  color: #ff6464;
}

.notifBellButton {
  position: relative;
  min-height: 38px;
  min-width: 42px;
  padding: 0 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  color: #ffffff;
  cursor: pointer;
}

.notifBellButton:hover,
.notifBellButton.is-active {
  background: #30363d;
}

.notifBadge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #da3633;
  color: #ffffff;
  font-size: 11px;
  font-weight: bold;
  line-height: 18px;
  text-align: center;
}

.notifBadge[hidden] {
  display: none !important;
}

.notifDrawerBackdrop {
  position: fixed;
  top: 70px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.45);
}

.notifDrawerBackdrop[hidden] {
  display: none !important;
}

.notifDrawer {
  position: fixed;
  top: 70px;
  right: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  width: 400px;
  max-width: 100vw;
  height: calc(100vh - 70px);
  overflow: hidden;
  border-left: 1px solid #30363d;
  background: #161b22;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  pointer-events: none;
}

.notifDrawer.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.notifDrawerHeader {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #1c2128;
  border-bottom: 1px solid #30363d;
}

.notifDrawerHeader h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.notifDrawerActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.notifDrawerBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px;
}

.notifList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notifItem {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}

.notifItem.is-unread {
  border-color: #2f81f7;
  background: #111821;
}

.notifTitle {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: bold;
}

.notifMeta {
  margin: 0 0 6px;
  color: #8b949e;
  font-size: 12px;
}

.notifMessage {
  margin: 0;
  color: #c9d1d9;
  font-size: 13px;
}

.pageSection {
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #161b22;
  overflow: hidden;
}

.pageSection + .pageSection {
  margin-top: 24px;
}

.pageHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: #1c2128;
  border-bottom: 1px solid #30363d;
}

.pageHeader h2 {
  margin: 0;
  font-size: 18px;
}

.pageActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filterToolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.filterToolbar .filterInput {
  flex: 1 1 220px;
}

.filterToolbar select {
  min-width: 140px;
}

.pageToast {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 13px;
}

.pageToast.is-success {
  color: #3fb950;
}

.pageToast.is-error {
  color: #ff6464;
}

.adminAccessDenied {
  margin-bottom: 16px;
}

.filterInput,
.pageActions select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #ffffff;
  font-size: 13px;
}

.filterInput {
  min-width: 220px;
  flex: 1 1 220px;
}

.detailDrawerBackdrop {
  position: fixed;
  inset: 0;
  z-index: 8500;
  background: rgba(0, 0, 0, 0.45);
}

.detailDrawerBackdrop[hidden] {
  display: none !important;
}

.detailDrawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 8600;
  width: min(480px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #30363d;
  background: #0d1117;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.detailDrawer.is-open {
  transform: translateX(0);
}

.detailDrawerHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #30363d;
  background: #161b22;
}

.detailDrawerHeader h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.detailDrawerBody {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.detailBlock + .detailBlock {
  margin-top: 20px;
}

.detailBlock h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #c9d1d9;
}

.detailList {
  margin: 0;
  display: grid;
  gap: 10px;
}

.detailList > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  font-size: 13px;
}

.detailList dt {
  margin: 0;
  color: #8b949e;
}

.detailList dd {
  margin: 0;
  color: #c9d1d9;
  word-break: break-word;
}

.panelButton {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
}

.panelButton:hover {
  background: #30363d;
}

.panelButton:focus-visible,
.navLink:focus-visible,
.filterInput:focus-visible,
.pageActions select:focus-visible,
.formField input:focus-visible,
.formField select:focus-visible,
.formField textarea:focus-visible,
.logoutButton:focus-visible,
.notifBellButton:focus-visible,
.loginSubmit:focus-visible {
  outline: 2px solid #2f81f7;
  outline-offset: 2px;
}

.panelButton:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.panelBody {
  padding: 14px 16px;
}

.adminTableWrap,
.severityTableWrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.adminTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.adminTable thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.adminTable th,
.adminTable td {
  padding: 11px 12px;
  border-bottom: 1px solid #30363d;
  text-align: left;
  vertical-align: middle;
}

.adminTable td.cell-wrap {
  white-space: normal;
  min-width: 120px;
}

.adminTable th {
  color: #8b949e;
  font-weight: bold;
  background: #0d1117;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.adminTable tbody tr:hover {
  background: #161b2266;
}

.adminTable td {
  color: #c9d1d9;
}

.adminTable .col-actions {
  min-width: 140px;
}

.adminTable .col-status {
  min-width: 92px;
}

.progressCell {
  min-width: 120px;
}

.progressTrack {
  height: 8px;
  border-radius: 999px;
  background: #21262d;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  background: #2f81f7;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.modalBackdrop[hidden] {
  display: none !important;
}

.modalCard {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #161b22;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #30363d;
  background: #1c2128;
}

.modalHeader h2 {
  margin: 0;
  font-size: 18px;
}

.modalBody {
  padding: 16px;
}

.modalFooter {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid #30363d;
}

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.formField {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.formField.full {
  grid-column: 1 / -1;
}

.formField label {
  color: #8b949e;
  font-size: 13px;
}

.formField input,
.formField select,
.formField textarea {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #ffffff;
  font-size: 14px;
}

.formField textarea {
  min-height: 80px;
  resize: vertical;
}

.formHint {
  margin: 0;
  color: #8b949e;
  font-size: 12px;
}

.formError {
  margin: 0 0 12px;
  color: #ff6464;
  font-size: 13px;
  min-height: 18px;
}

.checkboxList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}

.checkboxRow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #c9d1d9;
}

.actionRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.badge.is-active {
  background: #16803c33;
  color: #3fb950;
  border: 1px solid #2ea043;
}

.badge.is-inactive {
  background: #8f242433;
  color: #ff7b72;
  border: 1px solid #f85149;
}

.badge.is-neutral {
  background: #30363d66;
  color: #8b949e;
  border: 1px solid #484f58;
}

.panelButton.danger {
  border-color: #f85149;
  color: #ff7b72;
}

.panelButton.primary {
  border-color: #2f81f7;
  background: #238636;
}

@media (max-width: 720px) {
  .formGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .pageHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .filterToolbar,
  .pageActions {
    width: 100%;
  }

  .adminTable th,
  .adminTable td {
    padding: 10px;
  }
}

@media (max-width: 900px) {
  .appLayout {
    flex-direction: column;
  }

  .sideNav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #30363d;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .sideNavTitle {
    width: 100%;
    margin: 0 0 4px;
  }

  .navLink {
    margin-bottom: 0;
  }

  .cameraGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .notifDrawer {
    width: 100vw;
    border-left: none;
  }

  .notifItem {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .pageContent {
    padding: 12px;
  }

  .cameraScreen {
    height: 260px;
  }

  .topBar {
    padding: 0 15px;
  }

  .topBar h1 {
    font-size: 19px;
  }
}
