/*
 * Lab CCTV web interface
 *
 * Dark interface using the existing typography, geometry, and spacing system.
 * All fonts are local system fonts; there are no external runtime dependencies.
 */

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --navy: #080d14;
  --navy-mid: #0c1622;
  --navy-light: #122438;

  --water: #39a9ff;
  --water-bright: #67c1ff;
  --water-pale: #10283b;
  --water-tint: #0d1a26;

  --bg: #070b11;
  --card: #0d141e;
  --surface: #0b121b;
  --row-alt: #0a1119;

  --text: #e7edf5;
  --text-mid: #bac7d5;
  --text-muted: #7f91a5;

  --border: #263445;
  --border-lite: #1b2836;
  --focus-ring: rgba(57, 169, 255, 0.22);

  --success: #68d391;
  --success-bg: #10271d;
  --success-border: #245c3d;
  --error: #ff8f86;
  --error-bg: #2b1718;
  --error-border: #613033;

  --btn-primary: #1976d2;
  --btn-primary-hover: #2588e6;
  --btn-primary-shadow: rgba(25, 118, 210, 0.28);
  --btn-bg: #121d29;
  --btn-hover: #192838;
  --btn-border: #31465b;
  --btn-text: #dbe8f5;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.22), 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.25), 0 2px 5px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 16px 38px rgba(0, 0, 0, 0.34), 0 4px 12px rgba(0, 0, 0, 0.24);

  --font-ui: "Bahnschrift", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-data: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", "Courier New", monospace;
}

/* ── Reset and document defaults ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% -8%, rgba(57, 169, 255, 0.09), transparent 34rem),
    linear-gradient(rgba(103, 193, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103, 193, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 52px 52px, 52px 52px;
  font-family: var(--font-data);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.2;
}

h1 {
  margin-bottom: 5px;
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 800;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 4px;
  font-size: clamp(23px, 2vw, 30px);
  font-weight: 750;
}

h3 {
  margin-bottom: 0;
  font-size: 21px;
  font-weight: 750;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

/* Used for accessible labels that should not take visual space. */
.sr-only {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding-right: 24px;
  padding-left: 24px;
}

/* ── Header and navigation ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-image:
    linear-gradient(135deg, #080d14 0%, #0c1622 62%, #10253a 100%),
    repeating-linear-gradient(
      -50deg,
      transparent,
      transparent 28px,
      rgba(255, 255, 255, 0.012) 28px,
      rgba(255, 255, 255, 0.012) 29px
    );
  border-bottom: 1px solid rgba(103, 193, 255, 0.12);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.34);
}

.topbar-inner {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.topbar-wave {
  height: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 34' preserveAspectRatio='none'%3E%3Cpath fill='%23070b11' d='M0%2C17 C240%2C34 480%2C0 720%2C17 C960%2C34 1200%2C6 1440%2C13 L1440%2C34 L0%2C34 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand:focus-visible {
  border-radius: 8px;
  outline: 2px solid var(--water-bright);
  outline-offset: 5px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  color: #ffffff;
  border: 2px solid var(--water-bright);
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(0, 168, 232, 0.42);
}

.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-text {
  display: grid;
  min-width: 0;
}

.brand-title {
  display: block;
  max-width: min(48vw, 680px);
  overflow: hidden;
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.nav-link,
.nav-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  color: rgba(225, 240, 252, 0.84);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}

.nav-link:hover,
.nav-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.nav-link:focus-visible,
.nav-button:focus-visible {
  outline: 2px solid var(--water-bright);
  outline-offset: 2px;
}

.signout-form {
  min-width: 0;
  margin: 0 0 0 4px;
}

.nav-button {
  max-width: 250px;
  gap: 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Page structure ──────────────────────────────────────────────────────── */
main.container {
  padding-top: 24px;
  padding-bottom: 60px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 4px 0 22px;
}

.page-heading > div {
  min-width: 0;
}

.page-heading p:not(.page-kicker) {
  max-width: 860px;
  margin-bottom: 0;
  color: var(--text-muted);
}

.page-kicker {
  margin-bottom: 4px;
  color: var(--water);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.compact-heading {
  margin-top: 38px;
}

.muted {
  color: var(--text-muted);
}

.small {
  color: var(--text-muted);
  font-size: 13px;
}


/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  margin-bottom: 22px;
  padding: 22px 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 26, 38, 0.98), rgba(12, 19, 29, 0.98));
  border: 1px solid var(--border);
  border-top: 3px solid var(--water);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  color: var(--water);
  border-bottom: 1px solid var(--border-lite);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.card-heading-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}


/* ── Status treatments ───────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.025em;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill.success {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.status-pill.neutral {
  color: var(--text-mid);
  background: var(--row-alt);
  border-color: var(--border-lite);
}

.status-pill.danger {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error-border);
}

.status-pill.compact {
  min-height: 26px;
  padding: 4px 9px;
  font-size: 11px;
}

.alert {
  margin: 0 0 20px;
  padding: 13px 16px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.alert.success {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.alert.error {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error-border);
}

/* ── Forms and controls ──────────────────────────────────────────────────── */
.label {
  display: grid;
  gap: 7px;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.input,
.mini-input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input {
  height: 52px;
  padding: 0 15px;
  border-radius: 8px;
  font-family: var(--font-data);
  font-size: 17px;
}

.input::placeholder,
.mini-input::placeholder {
  color: #687b8f;
}

.input:hover:not(:disabled),
.mini-input:hover:not(:disabled) {
  border-color: #456785;
}

.input:focus,
.mini-input:focus {
  background-color: #0e1823;
  border-color: var(--water);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%23697f96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  appearance: none;
  cursor: pointer;
}

.mono-input {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--water);
}

.checkbox-label input:focus-visible {
  outline: 2px solid var(--water);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  color: var(--btn-text);
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-border);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.btn:hover:not(:disabled) {
  background: var(--btn-hover);
  border-color: #486a87;
  box-shadow: var(--shadow-sm);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid var(--water);
  outline-offset: 2px;
}

.btn.primary {
  color: #ffffff;
  background: var(--btn-primary);
  border-color: var(--btn-primary);
  box-shadow: 0 2px 10px var(--btn-primary-shadow);
}

.btn.primary:hover:not(:disabled) {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
  box-shadow: 0 4px 16px var(--btn-primary-shadow);
}

.btn.danger {
  color: var(--error);
  background: #211315;
  border-color: #613033;
}

.btn.danger:hover:not(:disabled) {
  color: #ffaaa3;
  background: #351a1d;
  border-color: #804047;
}

.btn.small-btn {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

.full-width {
  width: 100%;
}

.fields-grid,
.account-fields {
  display: grid;
  min-width: 0;
  align-items: end;
  gap: 16px;
}

.fields-grid {
  grid-template-columns: 1.25fr 1fr 1fr;
}

.account-fields {
  grid-template-columns: 1fr 1.25fr 0.8fr 0.8fr;
}

.form-footer,
.camera-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-lite);
}

.form-footer.right-aligned {
  justify-content: flex-end;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.auth-page main.container {
  padding-bottom: 36px;
}

.auth-wrap {
  display: grid;
  min-height: calc(100vh - 190px);
  place-items: center;
  padding: 24px 0 48px;
}

.auth-card {
  position: relative;
  width: min(480px, 100%);
  padding: 30px 32px 28px;
  border-top-color: var(--water-bright);
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: 32px;
}

.auth-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 18px;
  color: var(--water);
  background: var(--water-pale);
  border: 1px solid var(--border-lite);
  border-radius: 12px;
}

.auth-icon svg {
  width: 31px;
  height: 31px;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.stack .label:not(:first-of-type) {
  margin-top: 7px;
}

.stack .btn {
  margin-top: 12px;
}


/* ── Live camera dashboard ───────────────────────────────────────────────── */
.camera-grid {
  display: grid;
  gap: 20px;
}

.live-camera-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
}

.camera-card {
  padding: 0;
  border-top-color: var(--water-bright);
}

.camera-head {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
}

.camera-title-wrap {
  min-width: 0;
}

.camera-head h2 {
  overflow: hidden;
  margin: 1px 0 0;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  display: block;
  color: var(--water);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.live-dot {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-dot span {
  width: 7px;
  height: 7px;
  background: #49c978;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(73, 201, 120, 0.12);
}

.camera-frame {
  position: relative;
  overflow: hidden;
  background: #02060a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.camera-frame iframe {
  display: block;
  width: 100%;
  aspect-ratio: var(--camera-aspect, 16 / 9);
  background: #02060a;
  border: 0;
}

.camera-card-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
  background: var(--row-alt);
  border-top: 1px solid var(--border-lite);
}

.single-camera-card {
  padding: 0;
  border-top-color: var(--water-bright);
}


.single-camera-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding: 16px 18px;
  background: var(--row-alt);
  border-top: 1px solid var(--border-lite);
}


.empty-state {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  gap: 22px;
  color: var(--text-muted);
  text-align: left;
}

.empty-state svg {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  color: var(--border);
}

.empty-state h2 {
  margin-bottom: 5px;
  font-size: 23px;
}

.empty-state p {
  margin: 0;
}

.compact-empty {
  min-height: 150px;
}

/* ── Camera administration ───────────────────────────────────────────────── */

.camera-form {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 15px;
}

.admin-camera-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 410px), 1fr));
}

.camera-admin-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.camera-admin-card .camera-form {
  flex: 1;
}

.camera-admin-card .label {
  min-width: 0;
}

.camera-admin-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-lite);
}

.camera-admin-heading > div {
  min-width: 0;
}

.camera-admin-heading h3 {
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-form {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-lite);
}

.delete-form .btn {
  width: 100%;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border-lite);
  border-radius: 8px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table thead tr {
  background: linear-gradient(to bottom, #111c28, #0d1721);
  border-bottom: 2px solid var(--border);
}

.data-table th {
  padding: 13px 14px;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.065em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border-lite);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #101b27;
}

.table-empty {
  padding: 30px 18px !important;
  color: var(--text-muted) !important;
  text-align: center !important;
}

.accounts-table {
  min-width: 1050px;
}

.audit-table {
  min-width: 850px;
}

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

.actions form {
  margin: 0;
}

.inline-reset {
  display: inline-flex;
}

.mini-input {
  width: 150px;
  height: 36px;
  padding: 0 9px;
  border-radius: 7px 0 0 7px;
  font-size: 13px;
}

.inline-reset .btn {
  border-radius: 0 7px 7px 0;
}

/* ── Responsive layout ───────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .account-fields {
    grid-template-columns: 1fr 1fr;
  }

}

@media (max-width: 900px) {
  .topbar {
    position: static;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-top: 16px;
    padding-bottom: 12px;
  }

  .topbar-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .signout-form {
    margin-left: auto;
  }

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

  .fields-grid .label:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 16px;
  }

  .container {
    padding-right: 14px;
    padding-left: 14px;
  }

  .topbar-inner {
    gap: 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand-title {
    font-size: 21px;
  }

  .topbar-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-link,
  .nav-button {
    width: 100%;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 13px;
  }

  .signout-form {
    grid-column: 1 / -1;
    margin: 0;
  }

  .nav-button {
    max-width: none;
  }

  .topbar-wave {
    height: 20px;
  }

  main.container {
    padding-top: 17px;
    padding-bottom: 42px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 17px;
  }

  .page-heading .status-pill {
    align-self: flex-start;
  }

  h1 {
    font-size: 31px;
  }

  h2 {
    font-size: 24px;
  }

  .card {
    margin-bottom: 16px;
    padding: 18px 15px;
    border-radius: 9px;
  }

  .camera-card {
    padding: 0;
  }

  .camera-card-actions {
    padding: 11px 14px;
  }

  .camera-card-actions .btn {
    width: 100%;
  }

  .single-camera-card {
    padding: 0;
  }

  .single-camera-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .single-camera-actions .btn {
    width: 100%;
  }

  .card-heading {
    margin-bottom: 15px;
    font-size: 12px;
  }

  .form-footer,
  .camera-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-footer .btn,
  .camera-form-actions .btn {
    width: 100%;
  }

  .form-footer.right-aligned {
    align-items: stretch;
  }

  .fields-grid,
  .account-fields {
    grid-template-columns: 1fr;
  }

  .fields-grid .label:last-child {
    grid-column: auto;
  }

  .auth-wrap {
    min-height: auto;
    padding: 12px 0 30px;
  }

  .auth-card {
    padding: 24px 19px 22px;
  }

  .auth-card h1 {
    font-size: 28px;
  }

  .camera-head {
    min-height: 74px;
    padding: 13px 14px;
  }

  .camera-head h2 {
    font-size: 18px;
  }

  .empty-state {
    align-items: center;
    flex-direction: column;
    gap: 14px;
    padding-top: 28px;
    padding-bottom: 28px;
    text-align: center;
  }

  .camera-admin-card {
    padding: 17px 15px;
  }

  .camera-admin-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .camera-admin-heading .status-pill {
    align-self: flex-start;
  }

  .data-table th,
  .data-table td {
    padding: 11px 12px;
  }
}

@media (max-width: 390px) {
  .topbar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signout-form {
    grid-column: 1 / -1;
  }

  .brand-title {
    font-size: 20px;
  }

  .page-heading h1 {
    font-size: 29px;
  }
}

/* Respect operating-system accessibility preferences. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


/* Camera setup uses six small, predictable fields on wide screens. */
.camera-fields-grid {
  grid-template-columns: 1.3fr 1fr 0.9fr 0.8fr 0.9fr 0.8fr;
}

@media (max-width: 1180px) {
  .camera-fields-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .camera-fields-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard identity settings ─────────────────────────────────────────── */
.dashboard-title-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
}

.dashboard-title-form .btn {
  min-width: 132px;
}



.dashboard-heading h1 {
  max-width: 1100px;
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  .dashboard-title-form {
    grid-template-columns: 1fr;
  }

  .dashboard-title-form .btn {
    width: 100%;
  }


  .brand-title {
    max-width: 65vw;
  }
}


.rtsp-options {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 2px 0 0;
  padding: 16px;
  border: 1px solid var(--border-lite);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.rtsp-options[hidden] {
  display: none;
}

.rtsp-options legend {
  padding: 0 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-help {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 680px) {
  .rtsp-options {
    grid-template-columns: 1fr;
  }
}
