:root {
  --bg-1: #3a4f6e;
  --bg-2: #0f1316;
  --card-glass: rgba(255, 255, 255, 0.06);
  --card-inner: rgba(255, 255, 255, 0.025);
  --muted: rgba(220, 230, 240, 0.55);
  --accent: rgba(90, 170, 255, 0.95);
  --accent-strong: #d8f1ff;
  --text: #e9f6ff;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.04);
  --ok: #9ef0c1;
  --danger: #ff8f8f;
}

html {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 28px 40px;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
}

.top-nav {
  display: inline-flex;
  gap: 10px;
  margin: 0 0 22px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
}

.top-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.top-nav__link:hover {
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.top-nav__link.is-active {
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(90, 170, 255, 0.18), rgba(90, 170, 255, 0.06));
  border: 1px solid rgba(90, 170, 255, 0.2);
}

.top-nav__logout {
  min-width: 0;
  padding: 0.42rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(220, 230, 240, 0.72);
}

.top-nav__logout svg {
  display: block;
  width: 18px;
  height: 18px;
}

.top-nav__logout:hover {
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.main {
  max-width: 1200px;
  margin: 0 auto;
}

.page-login .main {
  display: flex;
  align-items: center;
  min-height: calc(100vh - 56px);
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: calc(100vh - 160px);
  padding: 2rem 1rem;
}

.login-form {
  width: 100%;
  max-width: 420px;
  padding: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.login-form h2 {
  margin: 0 0 1.75rem;
  text-align: center;
  font-size: 1.9rem;
  font-weight: 600;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

.login-form input {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.34);
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.35;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-form input:focus {
  outline: none;
  border-color: rgba(107, 163, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(107, 163, 255, 0.15);
  background: rgba(8, 12, 18, 0.48);
}

.login-form input::placeholder {
  color: rgba(220, 230, 240, 0.52);
}

.login-form .btn-primary {
  width: 100%;
  padding: 0.95rem 1.2rem;
  border: 1px solid rgba(107, 163, 255, 0.35);
  border-radius: 12px;
  color: #eef8ff;
  background: linear-gradient(180deg, rgba(90, 170, 255, 0.28), rgba(90, 170, 255, 0.16));
  box-shadow: 0 10px 24px rgba(35, 74, 120, 0.32);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-form .btn-primary:hover,
.login-form .btn-primary:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(90, 170, 255, 0.36), rgba(90, 170, 255, 0.2));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.login-form .flash-message {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 123, 147, 0.24);
  border-radius: 12px;
  background: rgba(255, 123, 147, 0.12);
  color: #ffd5dc;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
}

.subtitle {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-inline {
  min-width: 240px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-inline__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.9fr);
  gap: 28px;
  align-items: start;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  font-size: 13px;
  line-height: 1.3;
  position: relative;
  padding: 20px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: visible;
  transition:
    transform 420ms cubic-bezier(.2, .8, .2, 1),
    box-shadow 320ms cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}

.card:hover,
.card:focus-within {
  transform: translateY(-6px) scale(1.01);
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  z-index: 2;
}

.room-card {
  min-height: 680px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.plan-badge {
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line-soft);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-badge strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.room-plan {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 620px;
  overflow: hidden;
  border-radius: 14px;
  background: #11161c;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 10px 30px rgba(0, 0, 0, 0.35);
}

.room-plan__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.device {
  position: absolute;
  left: 50%;
  top: 6.5%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(250px, calc(100% - 64px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 31, 42, 0.82), rgba(11, 19, 26, 0.82));
  color: var(--text);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
  z-index: 3;
  touch-action: none;
  user-select: none;
}

.device:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.device.is-dragging {
  transform: translateX(-50%) scale(1.02);
  box-shadow:
    0 22px 40px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.device__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.45rem;
  flex: 0 0 auto;
}

.device__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device__meta strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
}

.device__meta span {
  color: var(--muted);
  font-size: 12px;
}

.device.is-on {
  border-color: rgba(90, 170, 255, 0.4);
  background: linear-gradient(180deg, rgba(22, 46, 70, 0.88), rgba(12, 26, 41, 0.88));
}

.device.is-on .device__icon {
  background: rgba(90, 170, 255, 0.18);
  box-shadow: 0 0 24px rgba(90, 170, 255, 0.24);
}

.device.is-off .device__icon {
  background: rgba(255, 255, 255, 0.04);
}

.device.is-loading,
.device:disabled {
  cursor: progress;
  opacity: 0.82;
}

.side-panel {
  min-height: 520px;
}

.camera-layout {
  grid-template-columns: minmax(0, 1fr);
}

.camera-grid-card {
  min-height: 520px;
}

.camera-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.camera-filter-tab {
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.camera-filter-tab:hover {
  transform: translateY(-1px);
  color: var(--accent-strong);
  border-color: rgba(90, 170, 255, 0.22);
}

.camera-filter-tab.is-active {
  color: var(--accent-strong);
  background: rgba(90, 170, 255, 0.14);
  border-color: rgba(90, 170, 255, 0.3);
}

.camera-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.camera-refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  color: var(--accent-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.camera-refresh-button:hover:not(:disabled) {
  border-color: rgba(90, 170, 255, 0.28);
  background: rgba(90, 170, 255, 0.12);
}

.camera-refresh-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.camera-refresh-button.is-loading span {
  animation: camera-refresh-spin 800ms linear infinite;
}

@keyframes camera-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  color: var(--accent-strong);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 170, 255, 0.28);
  background: linear-gradient(180deg, rgba(90, 170, 255, 0.14), rgba(90, 170, 255, 0.045));
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 11, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(82vh, 820px);
  overflow: auto;
  padding: 20px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 32, 44, 0.98), rgba(10, 17, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.camera-settings-panel {
  width: min(1040px, 100%);
  padding: 0;
}

.camera-settings-panel .modal__header {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 20px 22px 16px;
  background: rgba(18, 29, 40, 0.96);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

body.is-modal-open {
  overflow: hidden;
}

.camera-settings-form,
.camera-settings-list {
  display: flex;
  flex-direction: column;
}

.camera-settings-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 22px 22px;
}

.camera-settings-item {
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--line-soft);
  transition: opacity 160ms ease, border-color 160ms ease;
}

.camera-settings-item.is-disabled {
  opacity: 0.58;
}

.camera-settings-item:focus-within {
  opacity: 1;
  border-color: rgba(90, 170, 255, 0.3);
}

.camera-settings-item__header,
.camera-settings-item__identity,
.camera-settings-item__header-actions,
.camera-order,
.camera-switch,
.camera-favorite {
  display: flex;
  align-items: center;
}

.camera-settings-item__header {
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line-soft);
}

.camera-settings-item__identity {
  min-width: 0;
  gap: 10px;
}

.camera-settings-item__header-actions {
  flex: 0 0 auto;
  gap: 12px;
}

.camera-order {
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.14);
}

.camera-order-button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.camera-order-button:hover:not(:disabled) {
  background: rgba(90, 170, 255, 0.14);
}

.camera-order-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.camera-order-button:disabled {
  color: rgba(220, 230, 240, 0.18);
  cursor: default;
}

.camera-order__position {
  min-width: 20px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.camera-settings-item__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: contain;
}

.camera-settings-item__icon--fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 10px;
}

.camera-settings-item__identity h3 {
  overflow: hidden;
  margin: 0 0 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-settings-item__identity span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-settings-item__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 94px;
  gap: 12px;
  padding: 15px;
}

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

.camera-field--wide,
.camera-favorite {
  grid-column: 1 / -1;
}

.camera-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.camera-field select,
.camera-field input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(11, 19, 26, 0.82);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.camera-field input::placeholder {
  color: rgba(220, 230, 240, 0.28);
}

.camera-field.is-hidden {
  display: none;
}

.camera-switch {
  flex: 0 0 auto;
  gap: 8px;
  cursor: pointer;
}

.camera-switch__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.camera-switch input,
.camera-favorite input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.camera-switch__control {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 160ms ease;
}

.camera-switch__control::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(233, 246, 255, 0.75);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.32);
  transition: transform 160ms ease, background 160ms ease;
}

.camera-switch input:checked + .camera-switch__control {
  background: rgba(90, 170, 255, 0.75);
}

.camera-switch input:checked + .camera-switch__control::after {
  background: #fff;
  transform: translateX(18px);
}

.camera-switch input:focus-visible + .camera-switch__control,
.camera-favorite input:focus-visible + .camera-favorite__star {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.camera-favorite {
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
  cursor: pointer;
}

.camera-favorite__star {
  color: rgba(220, 230, 240, 0.25);
  font-size: 22px;
  line-height: 1;
  transition: color 160ms ease, transform 160ms ease;
}

.camera-favorite strong,
.camera-favorite small {
  display: block;
}

.camera-favorite strong {
  color: var(--text);
  font-size: 12px;
}

.camera-favorite small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.camera-favorite input:checked + .camera-favorite__star {
  color: #ffd166;
  transform: scale(1.08);
}

.camera-settings-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) minmax(180px, 1fr);
  gap: 10px;
  padding: 14px 22px 18px;
  background: rgba(10, 17, 24, 0.96);
  border-top: 1px solid var(--line-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.camera-settings-actions .ghost-button {
  margin-top: 0;
}

.camera-settings-panel .message {
  min-height: 0;
  margin: 0;
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.camera-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line-soft);
}

.camera-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(3, 7, 11, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.camera-preview-backdrop[hidden] {
  display: none;
}

body.is-camera-expanded {
  overflow: hidden;
}

.camera-tile.is-expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 31;
  width: min(1000px, calc(100vw - 48px), 150vh);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px;
  border-color: rgba(90, 170, 255, 0.28);
  background: linear-gradient(160deg, #182938, #091119 72%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
  transform: translate(-50%, -50%);
}

.camera-tile.is-expanded .camera-tile__title {
  font-size: 18px;
}

.camera-tile.is-expanded .camera-frame {
  border-color: rgba(90, 170, 255, 0.18);
}

.camera-tile__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.camera-tile__identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.camera-tile__title-copy {
  min-width: 0;
}

.camera-kind-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  object-fit: contain;
}

.camera-tile__title {
  margin: 0;
  font-size: 15px;
  color: var(--accent-strong);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.camera-configured-mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.camera-configured-mode::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(220, 230, 240, 0.35);
}

.camera-configured-mode.is-live::before {
  background: var(--ok);
}

.camera-configured-mode.is-refresh::before {
  background: #ffd166;
}

.camera-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(90, 170, 255, 0.12);
  color: var(--accent-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.camera-mode-button {
  cursor: pointer;
  transition:
    background 140ms ease,
    transform 140ms ease;
}

.camera-mode-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(90, 170, 255, 0.2);
}

.camera-mode-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.camera-status-icon {
  display: block;
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.camera-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(90, 170, 255, 0.12), transparent 32%),
    #091018;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.camera-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #03070b;
}

.camera-player-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.camera-player-button {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(6, 12, 18, 0.82);
  color: var(--accent-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.camera-player-button {
  padding: 9px 10px;
}

.camera-player-button:hover:not(:disabled) {
  background: rgba(14, 25, 38, 0.92);
}

.camera-player-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.camera-empty {
  padding: 28px;
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  border: 1px dashed var(--line);
}

.device-info {
  margin: 0 0 18px;
  display: grid;
  gap: 14px;
}

.device-info div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.device-info dt {
  color: var(--muted);
  margin-bottom: 4px;
  font-size: 12px;
}

.device-info dd {
  margin: 0;
  font-weight: 600;
  color: var(--accent-strong);
}

.primary-button,
.ghost-button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  border: 1px solid rgba(90, 170, 255, 0.32);
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(90, 170, 255, 0.18), rgba(90, 170, 255, 0.08));
}

.ghost-button {
  margin-top: 10px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.message {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.message.is-error {
  color: var(--danger);
}

.message.is-ok {
  color: var(--ok);
}

@media (max-width: 980px) {
  body {
    padding: 20px;
  }

  .page-header,
  .cards {
    grid-template-columns: 1fr;
    display: grid;
  }

  .status-inline {
    min-width: 0;
  }

  .camera-layout {
    grid-template-columns: 1fr;
  }

  .room-plan {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .camera-settings-panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }

  .camera-settings-panel .modal__header,
  .camera-settings-list,
  .camera-settings-actions {
    padding-right: 15px;
    padding-left: 15px;
  }

  .camera-settings-list {
    grid-template-columns: 1fr;
  }

  .camera-settings-item__body {
    grid-template-columns: minmax(0, 1fr) 94px;
  }

  .camera-settings-item__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .camera-settings-item__header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .camera-field--wide,
  .camera-favorite {
    grid-column: 1 / -1;
  }

  .camera-settings-actions {
    grid-template-columns: 1fr 1fr;
  }

  .card-title-row {
    flex-direction: column;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 0.75fr;
  }

  .room-card {
    min-height: 0;
  }

  .room-plan {
    min-height: 360px;
  }

  .device {
    width: min(220px, calc(100% - 28px));
    padding: 10px 12px;
  }

  .device__icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.3rem;
  }

  .camera-player-actions {
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .camera-tile.is-expanded {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 12px;
  }

  .camera-player-button {
    padding: 8px 9px;
  }
}

@media (max-width: 480px) {
  .login-form {
    padding: 1.6rem 1.25rem;
    border-radius: 18px;
  }

  .login-form h2 {
    font-size: 1.55rem;
  }

  .login-form .flash-message {
    padding: 0.8rem 0.9rem;
    font-size: 0.92rem;
  }
}
