:root {
  color-scheme: dark;
  --bg: #0d1720;
  --panel: #16212b;
  --panel-2: #1d2d3b;
  --text: #edf2f0;
  --muted: #a9bac7;
  --line: #31495d;
  --accent: #168bc7;
  --accent-2: #3b237d;
  --danger: #ef6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.ghost { background: transparent; }
button.danger { border-color: rgba(239, 107, 107, .65); color: #ffd8d8; }
input, select {
  width: 100%;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #0e1112;
  color: var(--text);
  padding: 0 10px;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.field-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #1289c8;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark { width: 34px; height: 34px; border-radius: 4px; background: #fff; display: grid; place-items: center; color: #168bc7; overflow: hidden; }
.portal-logo { width: 30px; height: 30px; display: block; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-download { color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 8px 10px; text-decoration: none; font-size: 13px; font-weight: 800; }
.user-menu { position: relative; }
.user-menu-btn { width: 38px; min-width: 38px; padding: 8px; }
.user-menu-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; min-width: 180px; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 12px 28px rgba(0, 0, 0, .35); }
.user-menu-pop span { color: var(--muted); font-size: 13px; word-break: break-word; }
.user-menu-pop button { justify-content: flex-start; }
.content { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-stack { width: min(420px, 100%); display: grid; gap: 10px; }
.login-box { width: min(420px, 100%); display: grid; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.login-box h1 { margin: 0; font-size: 24px; }
.login-box p { margin: 0; color: var(--muted); }
.remember-login { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: var(--text); }
.remember-login input { width: 16px; min-height: 16px; padding: 0; }
.login-downloads { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(16, 21, 22, .72); }
.login-downloads > strong { font-size: 13px; color: var(--muted); }
.login-download-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login-downloads .download-link { padding: 8px 10px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.live-grid { align-items: start; }
.live-size-1 { grid-template-columns: minmax(0, 1fr); }
.live-size-4 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.live-size-8, .live-size-16 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.live-size-1 .camera-card { max-width: 1280px; width: 100%; justify-self: center; }
.live-size-1 .player { max-height: 68vh; object-fit: contain; }
.camera-card { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; min-width: 0; }
.camera-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.camera-label { min-width: 0; }
.camera-title { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.camera-meta { margin-top: 2px; color: var(--muted); font-size: 12px; }
.badge { color: #fff; background: var(--accent-2); border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800; }
.player { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; background: #050606; }
.live-recording-player { object-fit: contain; }
.live-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #000;
}
.live-fullscreen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 6px 10px;
  background: #0d1720;
  border-bottom: 1px solid var(--line);
}
.live-fullscreen-head strong { overflow-wrap: anywhere; }
.live-fullscreen-head button { min-height: 32px; }
.live-fullscreen-player {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: contain;
  background: #000;
}
.live-playback-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: #101516;
}
.live-playback-bar button { min-height: 30px; padding: 0 9px; font-size: 12px; }
.live-playback-bar span { color: var(--muted); font-size: 12px; }
.live-card-date {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.live-card-date input {
  width: 128px;
  min-height: 30px;
  height: 30px;
  padding: 3px 6px;
  color: var(--text);
  background: #050808;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.live-card-timeline { padding: 2px 10px 8px; border-top: 1px solid var(--line); background: #101516; }
.compact-timeline { gap: 4px; }
.compact-timeline .timeline-marks { height: 18px; margin: 0 6px -4px; }
.compact-timeline .timeline-mark { font-size: 10px; }
.compact-timeline .timeline-mark i { height: 6px; }
.compact-timeline .timeline-times { font-size: 11px; }
.compact-timeline .timeline-times strong { font-size: 11px; }
.compact-timeline .alarm-marker {
  bottom: 1px;
  width: 4px;
  height: 14px;
  min-height: 14px;
  border: 0;
  border-radius: 3px;
  font-size: 0;
  color: transparent;
  transform: translateX(-50%);
  background: #ffc144;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .55);
}
.alarm-marker-compact {
  top: 2px !important;
  bottom: auto !important;
  width: 3px !important;
  min-width: 3px !important;
  height: 12px !important;
  min-height: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 3px !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  transform: translateX(-50%) !important;
  background: #ef5b5b !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .55) !important;
}
.compact-timeline .alarm-marker:hover { background: #ff9b5f; }
.player-open { color: var(--text); text-decoration: none; display: grid; place-items: center; border-top: 0; }
.player-open span { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; background: #121617; font-weight: 800; }
.tabs, .toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { align-self: start; }
.top-action {
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .12);
  color: #fff;
}
.top-action:hover { background: rgba(255, 255, 255, .2); }
.admin-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-title-row h2 { flex: 0 0 auto; }
.admin-subtabs { display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; margin: 0; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.admin-subtabs button { min-height: 28px; height: 28px; padding: 0 10px; border-radius: 3px; background: #f4f8fa; color: #176c98; border-color: #b9d5e3; }
.admin-subtabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 800; }
.admin-subtabs .save-filtered-cameras { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 800; }
.admin-subtabs .save-filtered-cameras:disabled { opacity: .6; cursor: progress; }
.admin-settings { display: grid; grid-template-columns: minmax(180px, 260px) auto minmax(120px, 1fr); gap: 10px; align-items: end; margin-top: 10px; }
.live-toolbar { width: 100%; justify-content: space-between; align-items: center; gap: 8px; }
.filter-bar, .live-controls, .layout-switch, .live-pager { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
.filter-bar { min-width: 0; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.live-controls { margin-left: auto; justify-content: flex-end; }
.mode-switch { display: flex; gap: 4px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #0e1112; }
.mode-switch button { min-height: 30px; padding: 0 9px; border-color: transparent; background: transparent; }
.mode-switch button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 800; }
.layout-btn {
  width: 38px;
  min-height: 32px;
  padding: 0;
  display: inline-grid;
  grid-template-columns: 16px auto;
  place-content: center;
  gap: 4px;
  font-weight: 800;
}
.layout-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.layout-icon {
  width: 16px;
  height: 16px;
  display: grid;
  gap: 2px;
}
.layout-icon::before,
.layout-icon::after,
.layout-icon span { content: ""; display: block; }
.layout-icon-1, .layout-icon-4 { grid-template-columns: repeat(2, 1fr); }
.layout-icon-8, .layout-icon-16 { grid-template-columns: repeat(4, 1fr); }
.layout-icon::before { box-shadow: 0 0 0 1px currentColor inset; }
.layout-icon-1::before { grid-column: 1 / -1; grid-row: 1 / -1; box-shadow: 0 0 0 1px currentColor inset; }
.layout-icon-4::before { grid-column: 1; grid-row: 1; box-shadow: 0 0 0 1px currentColor inset, 9px 0 0 -1px currentColor, 0 9px 0 -1px currentColor, 9px 9px 0 -1px currentColor; }
.layout-icon-8::before { grid-column: 1 / -1; height: 6px; box-shadow: 0 0 0 1px currentColor inset, 0 8px 0 -1px currentColor; }
.layout-icon-16::before { grid-column: 1 / -1; height: 14px; background:
  linear-gradient(currentColor 0 0) 0 0 / 3px 3px,
  linear-gradient(currentColor 0 0) 5px 0 / 3px 3px,
  linear-gradient(currentColor 0 0) 10px 0 / 3px 3px,
  linear-gradient(currentColor 0 0) 15px 0 / 3px 3px,
  linear-gradient(currentColor 0 0) 0 5px / 3px 3px,
  linear-gradient(currentColor 0 0) 5px 5px / 3px 3px,
  linear-gradient(currentColor 0 0) 10px 5px / 3px 3px,
  linear-gradient(currentColor 0 0) 15px 5px / 3px 3px,
  linear-gradient(currentColor 0 0) 0 10px / 3px 3px,
  linear-gradient(currentColor 0 0) 5px 10px / 3px 3px,
  linear-gradient(currentColor 0 0) 10px 10px / 3px 3px,
  linear-gradient(currentColor 0 0) 15px 10px / 3px 3px;
  background-repeat: no-repeat;
}
.featured-live { display: grid; gap: 8px; max-width: 1180px; width: 100%; margin: 0 auto; }
.ad-slot {
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #0b0d0e;
  color: var(--muted);
  font-weight: 800;
}
.featured-player-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.featured-player { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; background: #050606; }
.thumb-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(96px, 128px);
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
}
.thumb-card {
  height: auto;
  min-height: 78px;
  padding: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  text-align: left;
  background: var(--panel);
}
.thumb-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.thumb-card iframe, .thumb-card img { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; background: #050606; pointer-events: none; object-fit: cover; }
.thumb-placeholder {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #171d1f, #0b0d0e);
  color: var(--muted);
}
.thumb-placeholder .ico { width: 22px; height: 22px; opacity: .75; }
.thumb-placeholder .ico svg { width: 22px; height: 22px; }
.thumb-card span { padding: 5px 6px; font-size: 11px; font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.page-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.pager-btn:disabled { opacity: .45; cursor: default; }
.filter { min-height: 32px; height: 32px; padding: 0 10px; white-space: nowrap; }
.tab.active, .filter.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 800; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 12px; display: grid; gap: 12px; }
.panel h2 { margin: 0; font-size: 18px; }
.section-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.compact-form { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(140px, .7fr) repeat(4, minmax(110px, .5fr)) auto auto; gap: 10px; align-items: end; }
.camera-filter-grid { display: grid; grid-template-columns: .7fr 1.3fr 1fr .8fr; gap: 10px; align-items: end; }
.group-filter-grid { display: grid; grid-template-columns: .8fr 1fr 1fr; gap: 10px; align-items: end; }
.camera-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; color: var(--text); }
.check input { width: auto; min-height: auto; }
.table { display: grid; gap: 8px; }
.sheet {
  display: grid;
  align-content: start;
  overflow: auto;
  border: 1px solid #c9d0d2;
  border-radius: 4px;
  background: #f7f7f7;
  color: #111;
  max-height: calc(100vh - 238px);
  scrollbar-width: thin;
}
.sheet-header, .sheet-row {
  display: grid;
  min-width: max-content;
}
.sheet-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(#f9f9f9, #e8ecee);
  border-bottom: 1px solid #c9d0d2;
  font-size: 12px;
  font-weight: 800;
  color: #4b5154;
}
.sheet-header span, .sheet-row > span {
  position: relative;
  min-height: 24px;
  padding: 2px 8px;
  border-right: 1px solid #d8dcde;
  border-bottom: 1px solid #e2e4e5;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sheet-filter-btn {
  margin-left: auto;
  width: 18px;
  min-width: 18px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-left: 1px solid #c3c9cc;
  border-radius: 0;
  background: transparent;
}
.sheet-filter-btn::after {
  content: "";
  display: block;
  margin: 8px auto 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #8f979b;
}
.sheet-filter-btn.active { background: #d8edf8; }
.sheet-menu {
  position: absolute;
  top: 100%;
  right: -1px;
  z-index: 10;
  min-width: 230px;
  display: grid;
  gap: 0;
  padding: 3px;
  border: 1px solid #c9d0d2;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
  color: #111;
  font-size: 12px;
  font-weight: 600;
}
.sheet-menu button {
  justify-content: flex-start;
  border: 0;
  background: #fff;
  color: #111;
  min-height: 28px;
  text-align: left;
  border-radius: 0;
}
.sheet-menu button:hover { background: #d8edf8; }
.sheet-menu label {
  display: grid;
  gap: 3px;
  padding: 6px;
  border-top: 1px solid #e4e8ea;
  color: #111;
  font-weight: 700;
}
.sheet-menu input {
  min-height: 26px;
  height: 26px;
  border-color: #aab4b9;
  color: #111;
  background: #fff;
}
.sheet-row {
  background: #fff;
  color: #111;
  font-size: 12px;
  min-height: 25px;
}
.sheet-row:nth-child(odd) { background: #f4f4f4; }
.sheet-row:hover { background: #e8f4fb; }
.sheet-row.active { background: #b9dded; }
.sheet-row strong { color: #111; }
.sheet-row input, .sheet-row select {
  min-height: 22px;
  height: 22px;
  padding: 2px 6px;
  border-radius: 2px;
  border-color: #c9d0d2;
  background: #fff;
  color: #111;
  font-size: 12px;
}
.sheet-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  padding: 0;
}
.sheet-row button {
  min-height: 22px;
  height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 12px;
}
.sheet-actions { gap: 4px; flex-wrap: nowrap; }
.sheet-empty {
  padding: 12px;
  color: #666;
  font-size: 13px;
  background: #fff;
}
.ok-text { color: #008000; font-weight: 800; }
.danger-text { color: #d60000; font-weight: 800; }
.bad-text { color: #d60000; font-weight: 800; }
.family-panel h2, .family-panel h3 { margin: 0; }
.family-panel p { margin: 4px 0 0; color: var(--muted); }
.family-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 12px; align-items: start; }
.family-header { grid-template-columns: 1.4fr 90px 110px 180px 270px; }
.family-table { overflow: auto; border: 1px solid #c9d0d2; border-radius: 4px; background: #fff; color: #111; }
.family-table table { width: 100%; border-collapse: collapse; min-width: 820px; }
.family-table td { height: 34px; padding: 4px 8px; border-right: 1px solid #d8dcde; border-bottom: 1px solid #e2e4e5; font-size: 13px; }
.family-table tr:nth-child(odd) { background: #f4f4f4; }
.family-table tr:hover { background: #e8f4fb; }
.family-table input { min-height: 28px; height: 28px; background: #fff; color: #111; border-color: #c9d0d2; }
.inline-field { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; color: #4b5154; }
.inline-field span { font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.row-actions button { min-height: 28px; height: 28px; padding: 0 9px; }
.family-form { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.family-form.disabled-form { opacity: .72; }
.camera-sheet .sheet-header, .camera-sheet .camera-row {
  grid-template-columns: var(--camera-columns, 136px 196px 210px 150px 210px 136px 116px 48px 54px 72px 72px 68px 126px 238px);
}
.camera-sheet { min-height: 210px; }
.camera-row > span:first-child {
  overflow: hidden;
  white-space: nowrap;
}
.camera-row > span:first-child strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-row .camera-last-recording {
  gap: 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}
.camera-row .camera-last-recording small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-row .camera-product {
  align-items: flex-start;
  gap: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-row .camera-product small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #506168;
  text-overflow: ellipsis;
}
.camera-row .sheet-actions button {
  padding: 0 6px;
}
.camera-column-menu-wrap {
  position: relative;
  display: inline-flex;
}
.camera-column-menu {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  z-index: 30;
  min-width: 210px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 0;
  padding: 5px;
  border: 1px solid #c9d0d2;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
  color: #111;
}
.camera-column-menu label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.camera-column-menu label:hover { background: #e8f4fb; }
.camera-column-menu label.locked { color: #6b7377; }
.camera-column-menu input {
  width: 14px;
  height: 14px;
  min-height: 14px;
}
.camera-column-menu button {
  justify-content: flex-start;
  margin-top: 4px;
  border-radius: 2px;
  background: #e8f4fb;
  color: #111;
}
.support-camera-sheet .sheet-header, .support-camera-sheet .support-camera-row {
  grid-template-columns: 136px 190px 160px 190px 140px 210px 100px 124px;
}
.support-camera-row .save-support-camera { white-space: nowrap; width: 112px; padding: 0 8px; }
.group-sheet .sheet-header, .group-sheet .group-row {
  grid-template-columns: 150px 220px 150px 190px minmax(320px, 1fr) 90px;
}
.user-result-sheet .sheet-header, .user-result-sheet .user-result {
  grid-template-columns: minmax(190px, 1.4fr) minmax(190px, 1.4fr) minmax(150px, 1fr) 70px 90px;
}
.user-result.sheet-row {
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  padding: 0;
  justify-items: stretch;
  background: #fff;
}
.user-result.sheet-row.active { background: #fff5ce; box-shadow: inset 3px 0 0 var(--accent-2); }
.user-admin-layout { grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); }
.user-admin-layout #userEditorMount { min-width: 0; }
.status-sheet .sheet-header, .status-sheet .status-row {
  grid-template-columns: 112px minmax(210px, 1.35fr) minmax(150px, .85fr) 90px 90px minmax(190px, 1fr) minmax(190px, 1fr) 110px;
}
.status-row.active { background: #fff5ce; box-shadow: inset 3px 0 0 var(--accent-2); }
.status-row small { display: block; color: #777; font-size: 11px; }
.status-row .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.status-row .status-pill.online {
  color: #052e16;
  background: #7ee787;
  border: 1px solid #238636;
}
.status-row .status-pill.offline {
  color: #fff;
  background: #d60000;
  border: 1px solid #8f0000;
}
.admin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); gap: 14px; align-items: start; }
.user-row { display: grid; grid-template-columns: 1.1fr .7fr 2.4fr auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #121617; }
.user-search { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; align-items: end; }
.user-workspace { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.8fr); gap: 12px; align-items: start; }
.user-results { display: grid; gap: 8px; align-content: start; }
.user-result { min-height: auto; padding: 10px; display: grid; gap: 3px; justify-items: start; text-align: left; background: #121617; }
.user-result.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(31, 191, 117, .3) inset; }
.user-result span { color: var(--muted); font-size: 12px; }
.user-result small { color: #b8d8cc; font-size: 11px; }
.user-editor { display: grid; gap: 10px; padding: 10px; }
.ixc-user-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 10px; border: 1px solid rgba(31, 191, 117, .35); border-radius: 8px; background: rgba(31, 191, 117, .06); }
.ixc-user-info div { display: grid; gap: 2px; min-width: 0; }
.ixc-user-info .wide { grid-column: 1 / -1; }
.ixc-user-info span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.ixc-user-info strong { overflow-wrap: anywhere; }
.password-reset-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 10px; align-items: end; }
.password-field { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: stretch; }
.password-field input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.password-toggle {
  min-height: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.password-toggle .ico,
.password-toggle .ico svg { width: 18px; height: 18px; display: block; }
.subuser-box { display: grid; gap: 8px; border-top: 1px solid #d8dcde; padding-top: 10px; }
.subuser-list { display: grid; gap: 5px; }
.subuser-row { min-height: 32px; padding: 6px 8px; display: grid; gap: 2px; text-align: left; background: #fff; color: #111; border-color: #c9d0d2; }
.subuser-row span { color: #566268; font-size: 11px; }
.subuser-form { display: grid; gap: 8px; }
.compact-checks { max-height: 130px; overflow: auto; align-content: start; padding-right: 2px; }
.camera-row { align-items: center; }
.camera-source-field { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 6px 8px; color: #111; }
.camera-retention { min-width: 0; }
.camera-last-recording { display: grid; gap: 2px; color: #555; font-size: 12px; }
.camera-last-recording small { color: #777; overflow-wrap: anywhere; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-width: 0; }
.copy-field input { min-width: 0; }
.camera-rtmp-link { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.nvr-settings { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.nvr-settings .wide { grid-column: span 2; }
.nvr-admin-grid { display: grid; grid-template-columns: minmax(360px, .75fr) minmax(0, 1.5fr); gap: 12px; }
.nvr-list { display: grid; align-content: start; gap: 8px; }
.nvr-sheet .sheet-header, .nvr-sheet .nvr-row { grid-template-columns: minmax(180px, 1.2fr) minmax(170px, 1fr) 120px 70px; }
.nvr-row.sheet-row {
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  padding: 0;
  justify-items: stretch;
  background: #fff;
}
.nvr-row.sheet-row.active { background: #fff5ce; box-shadow: inset 3px 0 0 var(--accent-2); }
.nvr-row small { display: block; color: #777; font-size: 11px; }
.nvr-list-item { min-height: auto; display: grid; gap: 3px; text-align: left; border-color: var(--line); background: #101516; }
.nvr-list-item.active { border-color: var(--accent); }
.nvr-list-item span, .nvr-list-item small { color: var(--muted); }
.group-row { align-items: center; }
.group-cameras { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.group-meta { display: block; margin: 3px 0 8px; color: var(--muted); font-size: 12px; }
.permission-block { display: grid; gap: 8px; }
.permission-title { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.alert-permission-block { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: rgba(15, 23, 42, .04); }
.alert-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.group-check { border-color: rgba(31, 191, 117, .55); background: rgba(31, 191, 117, .08); }
.audit-table { display: grid; gap: 6px; }
.audit-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 13px; }
.admin-sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 410px); gap: 10px; align-items: start; }
.admin-sheet-main { min-width: 0; display: grid; gap: 10px; }
.sheet-toolbar { margin: 0; }
.admin-work-panel {
  background: #eef2f4;
  color: #111;
  border-color: #b9c7ce;
  padding: 8px;
  gap: 8px;
}
.admin-work-panel h2 {
  color: #111;
  font-size: 15px;
  line-height: 1.1;
}
.admin-work-panel .section-actions {
  min-height: 34px;
  padding: 0;
}
.admin-work-panel .muted {
  color: #506168;
}
.admin-work-panel .actions button {
  min-height: 30px;
  height: 30px;
  border-radius: 3px;
}
.admin-work-panel .admin-sheet-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: 8px;
}
.admin-work-panel .camera-admin-layout {
  grid-template-columns: minmax(0, 1fr);
}
.admin-work-panel .camera-admin-layout.side-open {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
}
#adminCameraSideMount:empty { display: none; }
.admin-work-panel .table {
  gap: 0;
}
.admin-side-panel {
  position: sticky;
  top: 64px;
  min-height: 292px;
  border: 1px solid #b9c7ce;
  border-radius: 4px;
  background: #fff;
  color: #111;
  overflow: hidden;
}
.side-tabs {
  display: flex;
  background: #168bc7;
  color: #fff;
}
.side-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-weight: 800;
}
.side-tabs button.active { background: #e9f4fb; color: #3b237d; }
.side-form {
  display: grid;
  gap: 6px;
  padding: 8px;
}
.side-form label {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #111;
  font-size: 12px;
}
.side-form input, .side-form select {
  min-height: 24px;
  height: 24px;
  background: #fff;
  color: #111;
  border-color: #c9d0d2;
  border-radius: 2px;
  font-size: 12px;
}
.side-form .check {
  display: flex;
  grid-template-columns: none;
  border-color: #c9d0d2;
  background: #fff;
  color: #111;
  padding: 5px 8px;
}
.admin-side-panel .check {
  border-color: #c9d0d2;
  background: #fff;
  color: #111;
}
.admin-side-panel .check input {
  accent-color: var(--accent);
}
.side-status {
  display: grid;
  gap: 3px;
  padding: 7px;
  border: 1px solid #d8dcde;
  background: #fff;
  color: #555;
  font-size: 12px;
}
.side-actions { display: flex; gap: 6px; justify-content: flex-end; }
.admin-side-panel > .side-actions { padding: 0 10px 10px; }
.status-summary-panel { gap: 8px; }
.status-summary-panel .section-actions { margin-bottom: -2px; }
.status-summary-panel #refreshStatus { min-height: 34px; }
.status-cards { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 8px; }
.status-filter-grid { display: grid; grid-template-columns: .8fr 1.1fr .9fr .75fr .85fr .85fr; gap: 8px; align-items: end; }
.status-filter-grid label { gap: 4px; font-size: 12px; }
.status-filter-grid input, .status-filter-grid select { min-height: 34px; height: 34px; }
.status-card { border: 1px solid #c9d0d2; border-radius: 4px; background: #fff; color: #111; padding: 8px 10px; display: grid; gap: 3px; }
.status-card span { color: #506168; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.status-card strong { font-size: 24px; line-height: 1; }
.status-card small { color: #506168; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-updated { margin-top: -2px; font-size: 13px; }
.status-workspace-panel { min-height: calc(100vh - 224px); align-content: start; }
.status-layout { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
.status-layout:not(.side-open) { display: block; }
.status-layout.side-open { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
#statusSideMount { min-width: 0; }
#statusSideMount:empty { display: none; }
.status-layout:not(.side-open) #statusSideMount { display: none; }
.status-layout .admin-sheet-main { gap: 8px; width: 100%; }
.status-layout .section-actions h2 { font-size: 17px; }
.status-layout .sheet { max-height: calc(100vh - 344px); width: 100%; justify-self: stretch; }
.status-sheet {
  width: 100%;
}
.status-sheet .sheet-header,
.status-sheet .status-row {
  min-width: 100%;
}
.status-side-panel {
  top: 64px;
  min-height: 0;
  height: fit-content;
  align-self: start;
}
.status-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid #c9d0d2;
  background: #168bc7;
  color: #111;
}
.status-side-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.status-side-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-side-head strong, .status-side-head span { color: #fff; }
.status-side-head span { font-size: 12px; font-weight: 800; }
.status-side-head button {
  flex: 0 0 auto;
  min-height: 24px;
  height: 24px;
  padding: 0 8px;
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 3px;
  font-size: 12px;
}
.status-side-grid {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0;
  padding: 8px 10px 10px;
  font-size: 12px;
}
.status-side-grid span,
.status-side-grid strong {
  min-height: 26px;
  padding: 5px 0;
  border-bottom: 1px solid #e1e5e7;
}
.status-side-grid span { color: #566268; font-weight: 700; }
.status-side-grid strong { color: #111; overflow-wrap: anywhere; }
.status-card.warn { border-color: rgba(245, 185, 66, .65); }
.status-card.danger { border-color: rgba(239, 107, 107, .75); }
.status-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.status-table { width: 100%; min-width: 860px; border-collapse: collapse; background: #121617; }
.status-table th, .status-table td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: middle; }
.status-table th { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; background: var(--panel-2); }
.status-table td span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.status-pill { display: inline-flex !important; align-items: center; width: fit-content; margin: 0 !important; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; color: var(--text) !important; font-weight: 800; }
.status-pill.ok { color: #07120d !important; background: var(--accent); border-color: var(--accent); }
.status-pill.warn { color: #07120d !important; background: var(--accent-2); border-color: var(--accent-2); }
.muted { color: var(--muted); }
.error { color: #ffd8d8; background: rgba(239, 107, 107, .14); border: 1px solid rgba(239, 107, 107, .4); padding: 10px; border-radius: 6px; }
.status-box { color: #07120d; background: var(--accent-2); border: 1px solid rgba(245, 185, 66, .7); padding: 10px; border-radius: 6px; font-weight: 800; }
.hidden { display: none !important; }
.ico { display: inline-grid; place-items: center; width: 18px; height: 18px; vertical-align: -4px; }
.ico svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.brand-mark .ico { width: 18px; height: 18px; }
.stream-links { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.stream-links a { color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: #121617; font-size: 13px; }
.stream-links a:hover { border-color: var(--accent); }
.recording-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 10px; align-items: end; }
.recording-list { display: grid; gap: 10px; }
.recording-row { display: grid; grid-template-columns: 220px minmax(280px, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 10px; }
.recording-row div { display: grid; gap: 4px; }
.recording-row span { color: var(--muted); font-size: 13px; }
.recording-row video { width: 100%; max-height: 260px; background: #050606; border-radius: 6px; }
.playback-nvr { height: calc(100vh - 118px); min-height: 520px; display: grid; grid-template-columns: 200px minmax(0, 1fr) 210px; grid-template-rows: minmax(260px, 1fr) 128px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #0b0d0e; }
.playback-camera-list { overflow-y: auto; background: #f7f7f7; color: #111; padding: 6px; display: grid; align-content: start; gap: 2px; }
.playback-camera { min-height: 24px; padding: 3px 5px; border: 0; background: transparent; color: #111; display: flex; align-items: center; gap: 6px; text-align: left; font-size: 13px; }
.playback-camera .ico { width: 13px; height: 13px; color: #111; }
.playback-camera.active { color: #e31722; font-weight: 700; }
.playback-main { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr); background: #303030; overflow: hidden; }
.playback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 2px; background: #101010; }
.playback-slots-1 .playback-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.playback-slots-4 .playback-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.playback-cell { position: relative; min-height: 120px; background: #303030; border: 1px solid #151515; overflow: hidden; }
.playback-cell.active { border-color: #ffe100; }
.playback-cell.assigned { background: #262626; cursor: pointer; }
.playback-cell.empty { cursor: pointer; }
.playback-cell.empty:hover, .playback-cell.assigned:hover { border-color: #777; }
.playback-cell-title { position: absolute; top: 6px; left: 8px; z-index: 2; color: #fff; font-size: 12px; text-shadow: 0 1px 2px #000; }
.playback-cell video { width: 100%; height: 100%; display: block; object-fit: contain; background: #050505; }
.playback-empty-hint { height: 100%; display: grid; place-items: center; color: #d8d8d8; font-size: 13px; }
.playback-controls { min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 6px; background: #f5f5f5; color: #111; border-top: 1px solid #ccc; }
.playback-controls button { min-height: 26px; padding: 4px 10px; color: #111; background: #fff; border-color: #c8c8c8; }
.playback-controls button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.playback-search { background: #f4f4f4; color: #111; border-left: 1px solid #c8c8c8; padding: 10px; display: grid; align-content: start; gap: 10px; }
.playback-search label { color: #111; }
.playback-search input { background: #fff; color: #111; border-color: #c8c8c8; }
.playback-search .muted { color: #666; }
.playback-search-form { display: grid; gap: 10px; }
.playback-search-form button { background: #de1722; border-color: #de1722; color: #fff; }
.date-picker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.date-picker-row input { min-width: 0; width: 100%; }
.date-picker-row button {
  min-height: 36px;
  padding: 0 12px;
  background: #1d2d3b;
  border-color: #3b5367;
  color: #fff;
  white-space: nowrap;
}
.recording-layout-switch { display: grid; gap: 6px; }
.recording-layout-switch > span { color: #333; font-weight: 800; font-size: 13px; }
.recording-layout-switch .layout-switch { justify-content: flex-start; }
.playback-timeline { grid-column: 1 / -1; background: #050505; border-top: 1px solid #252525; padding: 5px 18px 7px; min-height: 128px; touch-action: none; cursor: grab; }
.playback-timeline:active { cursor: grabbing; }
.playback-timeline .muted { color: #c8c8c8; }
.nvr-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.nvr-table { width: 100%; border-collapse: collapse; min-width: 760px; background: #121617; }
.nvr-table th, .nvr-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
.nvr-table th { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; background: var(--panel-2); }
.nvr-table tr { cursor: pointer; }
.nvr-table tr:hover { background: rgba(31, 191, 117, .08); }
.nvr-table tr.active { background: rgba(245, 185, 66, .12); }
.nvr-table td:first-child, .nvr-table td:nth-child(2), .nvr-table th:first-child, .nvr-table th:nth-child(2) { width: 48px; text-align: center; }
.nvr-table td:nth-child(4) { width: 110px; white-space: nowrap; }
.nvr-table td:last-child { width: 110px; }
.nvr-table span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.nvr-select { width: auto; min-height: auto; }
.nvr-player { display: grid; gap: 10px; }
.nvr-player video { width: 100%; max-width: 1100px; max-height: 520px; aspect-ratio: 16 / 9; justify-self: center; background: #000; border: 1px solid var(--line); border-radius: 8px; }
.nvr-player-placeholder { width: 100%; max-width: 1100px; aspect-ratio: 16 / 9; justify-self: center; display: grid; place-items: center; background: #11181d; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-weight: 800; text-align: center; padding: 20px; }
.player-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.nvr-search-form { grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; }
.nvr-help-text { font-size: 13px; }
.nvr-scrub { width: 100%; display: grid; gap: 6px; touch-action: none; user-select: none; }
.nvr-scrub-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.nvr-scrub-head strong { color: #fff; font-size: 15px; font-weight: 900; text-align: center; }
.nvr-scrub-head span:last-child { text-align: right; }
.nvr-scrub-body { position: relative; height: 86px; overflow: hidden; border-radius: 8px; background: #070909; border: 1px solid #32434d; cursor: grab; touch-action: none; user-select: none; }
.nvr-scrub-body.dragging { cursor: grabbing; }
.nvr-scrub-records { position: absolute; left: 0; right: 0; bottom: 12px; height: 34px; background: rgba(255, 255, 255, .09); }
.nvr-scrub-block { position: absolute; top: 0; bottom: 0; background: #eef4f8; border-left: 1px solid rgba(0, 0, 0, .2); border-right: 1px solid rgba(0, 0, 0, .2); }
.nvr-scrub-marks { position: absolute; inset: 8px 0 auto; height: 30px; }
.nvr-scrub-mark { position: absolute; top: 0; transform: translateX(-50%); color: #d9e7ee; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000; pointer-events: none; }
.nvr-scrub-mark i { width: 1px; height: 10px; margin: 0 auto 2px; display: block; background: #d9e7ee; opacity: .9; }
.nvr-scrub-playhead { position: absolute; top: 4px; bottom: 5px; left: 50%; width: 0; pointer-events: none; }
.nvr-scrub-playhead i { position: absolute; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); background: #ff2b3a; box-shadow: 0 0 0 1px rgba(255, 255, 255, .5), 0 0 8px rgba(255, 43, 58, .55); }
.nvr-native-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: .01; cursor: pointer; touch-action: pan-x; accent-color: var(--accent); z-index: 4; }
.nvr-scrub-help { color: var(--muted); font-size: 12px; text-align: center; }
.nvr-app-playback + .panel { display: none; }
.nvr-app-playback { padding: 6px 10px; gap: 6px; }
.nvr-app-playback h2 { display: none; }
.nvr-app-playback .nvr-player { gap: 4px; }
.nvr-app-playback .nvr-player video,
.nvr-app-playback .nvr-player-placeholder {
  max-width: 1040px;
  max-height: min(360px, 38vh);
  border-radius: 6px;
}
.nvr-app-playback .player-controls {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding: 2px 0;
  gap: 6px;
}
.nvr-app-playback .player-controls button { min-height: 32px; height: 32px; padding: 0 10px; }
.nvr-app-playback .stream-links,
.nvr-app-playback > .muted { display: none; }
.nvr-app-playback .recording-form { margin-top: 0; gap: 6px; }
.nvr-app-playback .recording-form label { gap: 3px; font-size: 12px; }
.nvr-app-playback .recording-form input,
.nvr-app-playback .recording-form select { min-height: 34px; height: 34px; padding: 0 8px; }
.nvr-app-playback .recording-form button { min-height: 34px; height: 34px; }
.nvr-app-playback .status-box { padding: 6px 10px; min-height: 32px; }
.nvr-app-playback .nvr-scrub { gap: 2px; }
.nvr-app-playback .nvr-scrub-head { font-size: 11px; }
.nvr-app-playback .nvr-scrub-head strong { font-size: 14px; }
.nvr-app-playback .nvr-scrub-body { height: 66px; border-radius: 6px; }
.nvr-app-playback .nvr-scrub-records { bottom: 10px; height: 30px; }
.nvr-app-playback .nvr-scrub-marks { top: 6px; }
.nvr-app-playback .nvr-scrub-help { display: none; }
@media (max-width: 760px) {
  .nvr-search-form { grid-template-columns: 1fr; }
  .nvr-app-playback .nvr-player video,
  .nvr-app-playback .nvr-player-placeholder { max-height: 34vh; }
}
.timeline { min-height: 36px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(20px, 1fr); gap: 3px; align-items: stretch; }
.timeline-segment { min-height: 28px; padding: 0; background: var(--accent); border-color: rgba(31, 191, 117, .8); }
.timeline-segment.active { outline: 2px solid var(--accent-2); outline-offset: 2px; background: var(--accent-2); }
.timeline-segment.disabled { background: var(--panel-2); border-color: var(--line); cursor: not-allowed; opacity: .55; }
.timeline.local-timeline { display: flex; gap: 3px; cursor: pointer; user-select: none; }
.timeline.local-timeline .timeline-segment { display: block; border: 1px solid rgba(31, 191, 117, .8); border-radius: 6px; pointer-events: none; }
.timeline-range-wrap { position: relative; display: grid; gap: 4px; width: 100%; min-height: 112px; align-content: center; }
.timeline-zoom-controls { display: flex; justify-content: flex-end; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; touch-action: manipulation; }
.timeline-zoom-controls button { min-width: 42px; height: 26px; min-height: 26px; padding: 0 8px; display: grid; place-items: center; background: #1b2022; color: #eef5f1; border-color: #3a4447; white-space: nowrap; }
.timeline-speed { display: flex; align-items: center; gap: 4px; color: #eef5f1; white-space: nowrap; }
.timeline-speed select { min-height: 26px; height: 26px; width: 62px; padding: 0 6px; background: #1b2022; color: #eef5f1; border: 1px solid #3a4447; border-radius: 6px; font-weight: 700; }
.timeline-selection-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: #eef5f1; font-size: 12px; touch-action: manipulation; }
.timeline-selection-controls button { min-height: 24px; height: 24px; padding: 0 8px; background: #1b2022; color: #eef5f1; border-color: #3a4447; white-space: nowrap; }
.timeline-selection-controls strong { min-width: 172px; text-align: center; color: var(--accent-2); font-size: 12px; }
.timeline-marks { position: relative; height: 24px; margin: 0 8px -2px; color: rgba(238, 245, 241, .82); cursor: grab; }
.timeline-mark { position: absolute; top: 0; transform: translateX(-50%); display: grid; justify-items: center; gap: 1px; font-size: 12px; white-space: nowrap; pointer-events: none; }
.timeline-mark i { width: 1px; height: 8px; background: rgba(238, 245, 241, .82); display: block; }
.timeline-mark b { font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); }
.alarm-marker {
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--danger);
  transform: translateX(-50%);
  z-index: 3;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.alarm-marker:hover { background: #ff9b5f; border-color: var(--accent-2); }
.timeline-range { width: 100%; height: 28px; accent-color: var(--accent); cursor: pointer; }
.timeline-records { position: relative; height: 28px; margin: -2px 9px -8px; background: #242424; border-radius: 2px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.timeline-record-block { position: absolute; top: 0; bottom: 0; padding: 0; border: 0; border-radius: 0; background: #f5f6f7; cursor: pointer; min-width: 2px; }
.timeline-record-block:hover { background: #dfefff; }
.timeline-live-cursor { position: absolute; left: 0; top: 58px; bottom: 29px; width: 2px; z-index: 5; transform: translateX(-1px); background: #de1722; box-shadow: 0 0 0 1px rgba(222, 23, 34, .22), 0 0 8px rgba(222, 23, 34, .85); pointer-events: none; }
.timeline-selection-track { position: relative; height: 6px; margin: -4px 9px -7px; background: rgba(255, 255, 255, .18); border-radius: 999px; overflow: hidden; }
.timeline-selection-track span { position: absolute; top: 0; bottom: 0; background: rgba(255, 193, 68, .92); border-radius: 999px; }
.timeline-range::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; }
.timeline-range::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -7px; }
.timeline-range::-moz-range-track { height: 10px; border-radius: 999px; }
.timeline-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 999px; }
.timeline-times { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; font-size: 12px; color: var(--muted); cursor: grab; }
.timeline-times strong { color: var(--accent-2); font-size: 13px; text-align: center; }
.timeline-times span:last-child { text-align: right; }

/* Overrides kept at the end so compact playback cards stay readable on mobile/WebView. */
.compact-timeline .timeline-marks {
  height: 18px !important;
  margin: 0 12px -2px !important;
  overflow: hidden;
}
.compact-timeline .alarm-marker {
  top: 2px !important;
  bottom: auto !important;
  width: 3px !important;
  min-width: 3px !important;
  height: 12px !important;
  min-height: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 3px !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  transform: translateX(-50%) !important;
  background: #ef5b5b !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .55) !important;
}
.compact-timeline .timeline-range {
  height: 24px !important;
  accent-color: #de1722;
}
.compact-timeline .timeline-range::-webkit-slider-thumb {
  width: 18px !important;
  height: 18px !important;
  margin-top: -4px !important;
}
.compact-timeline .timeline-range::-moz-range-thumb {
  width: 18px !important;
  height: 18px !important;
}
.download-link { color: #fff; background: var(--accent); border-radius: 6px; padding: 10px 12px; text-decoration: none; font-weight: 800; text-align: center; }
.apps-panel { max-width: 860px; }
.app-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; }
.app-grid.compact { max-width: 640px; }
.app-card { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: #101516; padding: 14px; }
.app-card h3 { margin: 0; }
.app-card p { margin: 0; color: var(--muted); }
.notice-box { display: grid; gap: 8px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #101516; color: var(--muted); }
.notice-box strong { color: #fff; }
.notice-box p { margin: 0; }
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-dot { width: 12px; height: 12px; border-radius: 999px; background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 107, 107, .16); }
.status-dot.online { background: var(--accent); box-shadow: 0 0 0 3px rgba(31, 191, 117, .16); }
.alarm-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)) auto auto auto; gap: 8px; align-items: end; }
.alarm-filter-grid button { min-height: 38px; }
.alarm-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #121617; }
.alarm-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.alarm-table th, .alarm-table td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: middle; line-height: 1.2; }
.alarm-table th { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; background: var(--panel-2); }
.alarm-table td { font-size: 13px; }
.alarm-table td span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.alarm-thumb { width: 112px; height: 72px; object-fit: cover; display: block; border: 1px solid var(--line); background: #101418; }
.alarm-media-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alarm-thumb-button { padding: 0; border: 0; background: transparent; cursor: pointer; min-height: auto; }
.alarm-thumb-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.alarm-clip-button { min-height: 32px; padding: 0 10px; }
.alarm-snapshot-viewer { position: fixed; inset: 0; z-index: 3000; display: grid; grid-template-rows: auto 1fr; background: #05080b; }
.alarm-snapshot-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #10202d; border-bottom: 1px solid var(--line); }
.alarm-snapshot-head strong,
.alarm-snapshot-head span { display: block; }
.alarm-snapshot-head span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.alarm-snapshot-head > div:last-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.button-like { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); color: var(--text); background: #1b2d3d; text-decoration: none; font-weight: 700; }
.alarm-snapshot-viewer > img,
.alarm-snapshot-viewer > video { width: 100%; height: 100%; object-fit: contain; background: #000; min-height: 0; }
@media (max-width: 700px) {
  .alarm-snapshot-head { align-items: stretch; flex-direction: column; gap: 8px; padding: 8px; }
  .alarm-snapshot-head > div:last-child { justify-content: flex-start; }
  .alarm-snapshot-head button,
  .alarm-snapshot-head .button-like { min-height: 36px; }
}
.alarm-table tr:hover { background: rgba(31, 191, 117, .08); }
@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 12px; }
  .content { padding: 8px; gap: 8px; }
  .form-row, .user-row, .user-search, .user-workspace, .camera-row, .camera-filter-grid, .group-filter-grid, .status-filter-grid, .audit-row, .admin-grid, .admin-settings, .compact-form, .recording-form, .recording-row, .alarm-filter-grid, .nvr-settings, .nvr-admin-grid { grid-template-columns: 1fr; }
  .family-layout { grid-template-columns: 1fr; }
  .family-table table { min-width: 720px; }
  .family-header { grid-template-columns: 1.2fr 80px 95px 160px 250px; }
  .admin-sheet-layout { grid-template-columns: 1fr; }
  .admin-side-panel { position: static; min-height: 0; }
  .side-form label { grid-template-columns: 1fr; }
  .nvr-settings .wide { grid-column: auto; }
  .grid, .app-grid { grid-template-columns: 1fr; }
  .live-grid,
  .live-size-4,
  .live-size-8,
  .live-size-16 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .live-grid .camera-head { padding: 6px 7px; min-height: 32px; }
  .live-grid .camera-title { font-size: 12px; line-height: 1.15; }
  .live-grid .live-playback-bar { padding: 5px 6px; gap: 4px; }
  .live-grid .live-playback-bar button { min-height: 25px; padding: 0 7px; font-size: 11px; }
  .live-toolbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .live-controls { margin-left: 0; justify-content: flex-start; flex: 0 0 auto; }
  .mode-switch button { min-height: 28px; padding: 0 8px; }
  .featured-live { gap: 6px; }
  .ad-slot { min-height: 46px; font-size: 12px; }
  .stream-links { overflow-x: auto; }
  .thumb-strip { grid-auto-columns: minmax(78px, 96px); padding-bottom: 6px; }
  .thumb-card { min-height: 66px; }
  .thumb-card span { font-size: 11px; padding: 5px 6px; }
  .nvr-player video { max-height: 58vh; }
  .playback-nvr { grid-template-columns: 1fr; grid-template-rows: auto minmax(260px, 38vh) auto auto; height: auto; min-height: 0; }
  .playback-nvr.mobile-single { grid-template-rows: auto minmax(230px, 34vh) auto auto; }
  .playback-camera-list { max-height: none; overflow-x: auto; overflow-y: hidden; display: flex; gap: 6px; padding: 6px; }
  .playback-camera { flex: 0 0 auto; border: 1px solid #d5d5d5; border-radius: 6px; padding: 7px 9px; }
  .playback-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(140px, 1fr)); }
  .playback-nvr.mobile-single .playback-grid { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .playback-search { border-left: 0; border-top: 1px solid #c8c8c8; }
  .timeline-zoom-controls { justify-content: stretch; display: grid; grid-template-columns: 44px 1fr auto 1fr 44px 74px; gap: 5px; }
  .timeline-zoom-controls button { height: 34px; min-height: 34px; font-size: 13px; }
  .timeline-speed { gap: 3px; font-size: 12px; justify-content: end; }
  .timeline-speed select { width: 48px; height: 34px; min-height: 34px; padding: 0 3px; font-size: 13px; }
  .timeline-selection-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .timeline-selection-controls strong { grid-column: 1 / -1; min-width: 0; order: -1; }
  .timeline-selection-controls button { height: 32px; min-height: 32px; font-size: 13px; }
  .timeline-marks { height: 30px; margin-inline: 16px; }
  .timeline-mark { font-size: 11px; }
  .timeline-mark b { background: rgba(5, 5, 5, .72); border-radius: 4px; padding: 1px 3px; }
  .timeline-times { font-size: 12px; gap: 6px; }
  .timeline-times strong { font-size: 13px; }
  .timeline-range { height: 38px; }
  .timeline-range::-webkit-slider-thumb { width: 30px; height: 30px; margin-top: -10px; }
  .timeline-range::-moz-range-thumb { width: 30px; height: 30px; }
}

/* mobile live compact grid */

@media (max-width: 900px) {
  .live-grid,
  .live-size-4,
  .live-size-8,
  .live-size-16 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .live-grid .camera-head { padding: 6px 7px; min-height: 32px; }
  .live-grid .camera-title { font-size: 12px; line-height: 1.15; }
  .live-grid .live-playback-bar { padding: 5px 6px; gap: 4px; }
  .live-grid .live-playback-bar button { min-height: 25px; padding: 0 7px; font-size: 11px; }
}


/* mobile live compact single column */
@media (max-width: 900px) {
  .live-grid,
  .live-size-4,
  .live-size-8,
  .live-size-16 {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
  .live-grid .camera-card { border-radius: 6px; }
  .live-grid .camera-head { padding: 6px 8px; min-height: 32px; }
  .live-grid .camera-title { font-size: 12px; line-height: 1.15; }
  .live-grid .player { aspect-ratio: 16 / 9; max-height: 38vh; }
  .live-grid .live-playback-bar { padding: 5px 7px; gap: 5px; }
  .live-grid .live-playback-bar button { min-height: 26px; padding: 0 8px; font-size: 11px; }
}

/* mobile snapshot compact cards 20260615-1649 */
@media (max-width: 900px) {
  .live-grid, .live-size-4, .live-size-8, .live-size-16 { grid-template-columns: minmax(0, 1fr) !important; gap: 6px !important; }
  .live-grid .camera-head { padding: 5px 8px !important; min-height: 30px !important; }
  .live-grid .camera-title { font-size: 12px !important; line-height: 1.15 !important; }
  .live-grid .player { height: auto !important; max-height: none !important; aspect-ratio: 16 / 9 !important; }
  .live-grid .live-snapshot { width: 100% !important; object-fit: cover !important; display: block !important; background: #050606 !important; }
  .live-grid .live-playback-bar { padding: 4px 7px !important; gap: 5px !important; }
  .live-grid .live-playback-bar button { min-height: 25px !important; padding: 0 8px !important; font-size: 11px !important; }
}

/* mobile snapshot compact cards and fullscreen 20260615-1702 */
@media (max-width: 900px) {
  .live-grid, .live-size-4, .live-size-8, .live-size-16 { grid-template-columns: minmax(0, 1fr) !important; gap: 6px !important; }
  .live-grid .camera-head { padding: 5px 8px !important; min-height: 30px !important; }
  .live-grid .camera-title { font-size: 12px !important; line-height: 1.15 !important; }
  .live-grid .player.live-snapshot { width: 100% !important; height: 160px !important; aspect-ratio: auto !important; object-fit: cover !important; display: block !important; }
  .live-grid .live-playback-bar { padding: 4px 7px !important; gap: 5px !important; }
  .live-grid .live-playback-bar button { min-height: 25px !important; padding: 0 8px !important; font-size: 11px !important; }
}
.live-fullscreen-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto 1fr; background: #000; }
.live-fullscreen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 10px; background: #0d1720; border-bottom: 1px solid var(--line); }
.live-fullscreen-head button { min-height: 32px; }
.live-fullscreen-frame { width: 100%; height: 100%; border: 0; display: block; background: #000; }

/* android compact live cards 20260615-1712 */
.portal-android-layout .live-grid,
.portal-android-layout .live-size-4,
.portal-android-layout .live-size-8,
.portal-android-layout .live-size-16 {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 5px !important;
}
.portal-android-layout .live-grid .camera-card { border-radius: 5px !important; }
.portal-android-layout .live-grid .camera-head { padding: 4px 7px !important; min-height: 26px !important; }
.portal-android-layout .live-grid .camera-title { font-size: 11px !important; line-height: 1.1 !important; }
.portal-android-layout .live-grid .player.live-snapshot {
  height: 110px !important;
  max-height: 110px !important;
  aspect-ratio: auto !important;
  object-fit: cover !important;
}
.portal-android-layout .live-grid .live-playback-bar { padding: 3px 6px !important; gap: 4px !important; }
.portal-android-layout .live-grid .live-playback-bar button { min-height: 23px !important; padding: 0 7px !important; font-size: 10px !important; }

/* forced compact live cards 20260615-1730 */
.portal-android-layout .live-grid .player.live-snapshot { height: 110px !important; max-height: 110px !important; aspect-ratio: auto !important; object-fit: cover !important; }
.portal-android-layout .live-grid .camera-head { padding: 4px 7px !important; min-height: 26px !important; }
.portal-android-layout .live-grid .camera-title { font-size: 11px !important; line-height: 1.1 !important; }
.portal-android-layout .live-grid .live-playback-bar { padding: 3px 6px !important; }
.portal-android-layout .live-grid .live-playback-bar button { min-height: 23px !important; padding: 0 7px !important; font-size: 10px !important; }

/* global compact mobile ui 20260615-1742 */
.ui-version-badge { position: fixed; right: 4px; bottom: 4px; z-index: 2000; font-size: 9px; color: #9fb3c0; background: rgba(0,0,0,.55); padding: 2px 4px; border-radius: 3px; pointer-events: none; }
.portal-compact-mobile,
.portal-compact-mobile body,
.portal-compact-mobile #app,
.portal-compact-mobile .shell,
.portal-compact-mobile .content {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
.portal-compact-mobile body { font-size: 13px !important; }
.portal-compact-mobile .topbar {
  min-height: calc(env(safe-area-inset-top, 0px) + 54px) !important;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 6px 6px !important;
  gap: 6px !important;
  justify-content: flex-start !important;
  overflow: visible !important;
  max-width: 100vw !important;
}
.portal-android-layout .topbar {
  min-height: calc(env(safe-area-inset-top, 0px) + 58px) !important;
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px) !important;
}
.portal-compact-mobile .brand { gap: 6px !important; font-size: 16px !important; white-space: nowrap !important; flex: 0 0 auto !important; }
.portal-compact-mobile .brand-mark { width: 26px !important; height: 26px !important; flex: 0 0 26px !important; }
.portal-compact-mobile .portal-logo { width: 24px !important; height: 24px !important; }
.portal-compact-mobile .actions { flex: 1 1 auto !important; min-width: 0 !important; overflow: visible !important; flex-wrap: nowrap !important; justify-content: flex-start !important; max-width: 100% !important; }
.portal-compact-mobile .tabs {
  gap: 5px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  padding-bottom: 2px !important;
  -webkit-overflow-scrolling: touch !important;
}
.portal-compact-mobile button,
.portal-compact-mobile .tab,
.portal-compact-mobile .filter {
  min-height: 31px !important;
  height: auto !important;
  padding: 5px 8px !important;
  font-size: 13px !important;
  line-height: 1.15 !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}
.portal-compact-mobile .content { padding: 5px !important; gap: 5px !important; }
.portal-compact-mobile .live-toolbar { gap: 5px !important; padding-bottom: 0 !important; flex-direction: column !important; align-items: stretch !important; width: 100% !important; max-width: 100% !important; overflow-x: hidden !important; }
.portal-compact-mobile .filter-bar,
.portal-compact-mobile .live-controls {
  gap: 5px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  -webkit-overflow-scrolling: touch !important;
}
.portal-compact-mobile .layout-switch { display: none !important; }
.portal-compact-mobile .mode-switch { display: flex !important; gap: 5px !important; flex: 0 0 auto !important; }
.portal-compact-mobile .live-pager { display: flex !important; gap: 5px !important; align-items: center !important; justify-content: flex-start !important; width: 100% !important; max-width: 100% !important; overflow-x: auto !important; padding: 0 !important; }
.portal-compact-mobile .live-pager button { min-width: 68px !important; }
.portal-compact-mobile .live-grid, .portal-compact-mobile .live-size-4, .portal-compact-mobile .live-size-8, .portal-compact-mobile .live-size-16 { grid-template-columns: minmax(0,1fr) !important; gap: 5px !important; width: 100% !important; max-width: 100% !important; }
.portal-compact-mobile .camera-card { border-radius: 6px !important; width: 100% !important; max-width: 100% !important; }
.portal-compact-mobile .camera-head { padding: 5px 7px !important; min-height: 28px !important; }
.portal-compact-mobile .camera-title { font-size: 12px !important; line-height: 1.15 !important; }
.portal-compact-mobile .player.live-snapshot { height: 72px !important; max-height: 72px !important; aspect-ratio: auto !important; object-fit: cover !important; }
.portal-compact-mobile .live-playback-bar { padding: 4px 5px !important; gap: 5px !important; width: 100% !important; max-width: 100% !important; overflow-x: auto !important; flex-wrap: nowrap !important; justify-content: flex-start !important; }
.portal-compact-mobile .live-playback-bar button { min-height: 29px !important; height: auto !important; padding: 4px 7px !important; font-size: 12px !important; line-height: 1.15 !important; }
.portal-compact-mobile .live-card-date { margin-left: 0 !important; min-height: 29px !important; font-size: 11px !important; }
.portal-compact-mobile .live-card-date input { width: 122px !important; min-height: 29px !important; height: 29px !important; padding: 3px 5px !important; font-size: 11px !important; }
.portal-compact-mobile .ui-version-badge { position: fixed; right: 4px; bottom: 4px; z-index: 99999; background: rgba(0,0,0,.72); color: #fff; font-size: 10px; padding: 2px 4px; border-radius: 4px; pointer-events: none; }

.portal-compact-mobile .user-menu { flex: 0 0 auto !important; position: relative !important; z-index: 100000 !important; }
.portal-compact-mobile .user-menu-btn { width: 42px !important; min-width: 42px !important; padding: 5px 8px !important; }
.portal-compact-mobile .user-menu-pop { position: fixed !important; top: 52px !important; right: 6px !important; z-index: 100001 !important; }

.portal-compact-mobile .mode-switch { display: flex !important; gap: 5px !important; flex: 0 0 auto !important; }
.portal-compact-mobile .mode-switch button { min-width: 74px !important; }
.portal-compact-mobile .layout-switch { display: none !important; }

.portal-compact-mobile .layout-switch { display: flex !important; gap: 5px !important; flex: 0 0 auto !important; }
.portal-compact-mobile .layout-switch button { min-width: 42px !important; }
@media (max-width: 700px) {
  .portal-compact-mobile .layout-switch { display: none !important; }
}

.server-monitor-table .sheet-head,
.server-monitor-table .sheet-row { grid-template-columns: 1.2fr .8fr .7fr 1.2fr .5fr; }
.status-ok { color: #0f8f4f; font-weight: 800; }
.status-bad { color: #c40000; font-weight: 800; }

.download-link.secondary { background: #1d2d3b; border-color: var(--line); }

.qr-batch-panel { max-width: 980px; }
.qr-batch-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(240px, .55fr); gap: 12px; align-items: start; }
.qr-batch-form { display: grid; grid-template-columns: minmax(220px, 1.4fr) 120px 120px 110px auto; gap: 8px; align-items: end; }
.qr-batch-form label { color: #111; }
.qr-batch-form input, .qr-batch-form select { background: #fff; color: #111; border-color: #c9d0d2; }
.qr-batch-log { display: grid; gap: 6px; margin-top: 10px; }
.qr-batch-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #c9d0d2; border-radius: 6px; background: #fff; color: #111; }
.qr-batch-item.ok { border-color: rgba(31, 191, 117, .55); }
.qr-batch-item.bad { border-color: rgba(239, 107, 107, .75); }
.qr-batch-item span { color: #566268; }
.qr-batch-notice { position: relative; padding-right: 36px; }
.notice-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #d9e7ef;
  font-size: 18px;
  line-height: 1;
}
.notice-close:hover { background: rgba(255,255,255,.12); }
.qr-stock-list { margin-top: 14px; }
.qr-stock-sheet .sheet-header, .qr-stock-row { grid-template-columns: 110px minmax(230px, 1fr) minmax(150px, .75fr) 130px 130px 100px; }
.qr-select-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.qr-select-all input {
  width: 13px;
  height: 13px;
  min-height: 13px;
}
.qr-select-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.qr-select-cell input {
  width: 14px;
  height: 14px;
  min-height: 14px;
}
.qr-printed-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  color: #111;
  white-space: nowrap;
}
.qr-printed-cell input {
  width: 14px;
  height: 14px;
  min-height: 14px;
}
.compact-row-btn {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.1;
}
.support-camera-row { grid-template-columns: 136px 190px 160px 190px 140px 210px 100px 124px; }
.support-camera-row small { display: block; color: var(--muted); font-weight: 500; }
@media (max-width: 900px) {
  .qr-batch-grid, .qr-batch-form { grid-template-columns: 1fr; }
  .qr-stock-row { grid-template-columns: 1fr; }
  .support-camera-row { grid-template-columns: 1fr; }
}

.add-camera-btn { background: #1b7aa8; border-color: #2499d1; }
.add-camera-dialog { position: fixed; inset: 0; z-index: 3500; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: rgba(0,0,0,.72); }
.add-camera-box { width: min(520px, 100%); display: grid; gap: 10px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.add-camera-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.add-camera-head strong { font-size: 18px; }
.add-camera-box video { width: 100%; aspect-ratio: 16 / 9; display: block; object-fit: cover; background: #05080b; border: 1px solid var(--line); border-radius: 6px; }
.add-camera-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.add-camera-actions .muted { flex: 1 1 220px; }
.add-camera-actions #addCameraQrFileBtn { font-weight: 800; }
.qr-file-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.add-camera-box label { display: grid; gap: 5px; font-weight: 700; }
.add-camera-box input { min-height: 36px; }
@media (max-width: 700px) {
  .add-camera-dialog { align-items: start; padding: calc(env(safe-area-inset-top, 0px) + 24px) 8px calc(env(safe-area-inset-bottom, 0px) + 12px); overflow: auto; }
  .add-camera-box { border-radius: 6px; }
  .add-camera-box video { max-height: 36vh; }
}
.portal-android-layout .add-camera-dialog,
.portal-compact-mobile .add-camera-dialog {
  align-items: start;
  padding-top: calc(env(safe-area-inset-top, 0px) + 34px) !important;
}
.live-offline-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  background: #151b20;
  color: #d7e6f2;
  text-align: center;
  padding: 16px;
}
.live-offline-card strong {
  color: #ff7777;
}
.live-offline-card span {
  color: #aebdca;
  font-size: 14px;
}

/* Final mobile/WebView override: live card timeline must stay compact. */
.compact-timeline .timeline-marks {
  height: 18px !important;
  margin: 0 12px -2px !important;
  overflow: hidden !important;
}
.compact-timeline .alarm-marker {
  top: 2px !important;
  bottom: auto !important;
  width: 3px !important;
  min-width: 3px !important;
  height: 12px !important;
  min-height: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 3px !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  transform: translateX(-50%) !important;
  background: #ef5b5b !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .55) !important;
}
.compact-timeline .timeline-range {
  height: 24px !important;
  accent-color: #de1722 !important;
}
.compact-timeline .timeline-range::-webkit-slider-thumb {
  width: 18px !important;
  height: 18px !important;
  margin-top: -4px !important;
}
.compact-timeline .timeline-range::-moz-range-thumb {
  width: 18px !important;
  height: 18px !important;
}
.live-grid .live-snapshot {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #050606;
}
.live-grid .live-snapshot:not(.loaded) {
  opacity: 1;
}

/* Live playback timeline, camera-app style. */
.live-day-timeline {
  gap: 3px !important;
  min-height: 122px !important;
  padding: 6px 12px 8px;
  background: #111415;
}
.live-day-timeline .timeline-day-label {
  display: grid;
  justify-items: center;
  gap: 0;
  color: #eef1f4;
  font-size: 15px;
  line-height: 1.2;
}
.live-day-timeline .timeline-day-label strong {
  color: #f5f7fb;
  font-size: 16px;
}
.live-day-timeline .timeline-day-label span {
  color: #d8dde5;
}
.live-day-timeline .timeline-marks {
  height: 24px !important;
  margin: 0 20px -2px !important;
  overflow: visible !important;
}
.live-day-timeline .timeline-mark {
  color: #f5f7fb;
  font-size: 12px !important;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.live-day-timeline .timeline-mark i {
  height: 7px !important;
  background: rgba(245,247,251,.92);
}
.live-day-timeline .alarm-marker {
  display: none !important;
}
.live-day-timeline .timeline-scrub-body {
  position: relative;
  height: 48px;
  margin: 0 8px;
  background: #242426;
  overflow: hidden;
  border-radius: 2px;
  touch-action: none;
  user-select: none;
}
.live-day-timeline .timeline-records {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: 300%;
  height: auto;
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  transform: translateX(-33.333%);
  will-change: transform;
}
.live-day-timeline .timeline-record-block {
  top: 0;
  bottom: 0;
  min-width: 3px;
  background: #f4f5fb;
  opacity: .96;
}
.live-day-timeline .timeline-events {
  position: absolute;
  inset: 0 auto 0 0;
  width: 300%;
  transform: translateX(-33.333%);
  will-change: transform;
  z-index: 4;
  pointer-events: none;
}
.live-day-timeline .timeline-event-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  min-width: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffc144 !important;
  transform: translateX(-50%);
  z-index: 4;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 5px rgba(255,193,68,.8) !important;
}
.live-day-timeline .timeline-selection-track {
  position: absolute;
  inset: 0;
  height: auto;
  margin: 0;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}
.live-day-timeline .timeline-selection-track span {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 193, 68, .65);
  border-left: 2px solid #ffc144;
  border-right: 2px solid #ffc144;
  border-radius: 0;
}
.live-day-timeline .timeline-live-cursor {
  top: -6px;
  bottom: -6px;
  width: 2px;
  z-index: 4;
  background: #e31522;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 0 6px rgba(227,21,34,.9);
}
.live-day-timeline .timeline-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
  pointer-events: none;
}
.live-day-timeline .timeline-times {
  margin: 0 8px;
  color: #aeb6bf;
  font-size: 12px;
}
.live-day-timeline .timeline-times strong {
  color: #6f2fb1;
  font-size: 13px;
}

/* Recordings playback timeline, same ruler behavior as live "Hoje". */
.recording-day-timeline {
  gap: 3px !important;
  min-height: 118px !important;
  padding: 6px 12px 8px;
  background: #111415;
}
.recording-day-timeline .timeline-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.recording-day-timeline .timeline-day-label {
  display: grid;
  justify-items: center;
  gap: 0;
  color: #eef1f4;
  font-size: 15px;
  line-height: 1.2;
}
.recording-day-timeline .timeline-day-label strong {
  color: #f5f7fb;
  font-size: 16px;
}
.recording-day-timeline .timeline-day-label span {
  color: #d8dde5;
}
.recording-day-timeline .timeline-selection-controls {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}
.recording-day-timeline .timeline-meta-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.recording-day-timeline .timeline-meta-controls strong {
  min-width: 0;
  color: #d7dde6;
  font-size: 12px;
}
.recording-day-timeline .timeline-marks {
  height: 24px !important;
  margin: 0 20px -2px !important;
  overflow: hidden !important;
  width: 300%;
  transform: translateX(-33.333%);
  will-change: transform;
}
.recording-day-timeline .timeline-mark {
  color: #f5f7fb;
  font-size: 12px !important;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.recording-day-timeline .timeline-mark i {
  height: 7px !important;
  background: rgba(245,247,251,.92);
}
.recording-day-timeline .alarm-marker {
  top: 0 !important;
  bottom: 0 !important;
  width: 2px !important;
  min-width: 2px !important;
  height: 100% !important;
  min-height: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  transform: translateX(-50%) !important;
  background: #ffc144 !important;
  box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 5px rgba(255,193,68,.8) !important;
}
.recording-day-timeline .timeline-scrub-body {
  position: relative;
  height: 52px;
  margin: 0 8px;
  background: #242426;
  overflow: hidden;
  border-radius: 2px;
  touch-action: none;
  user-select: none;
}
.recording-day-timeline .timeline-records {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: 300%;
  height: auto;
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  transform: translateX(-33.333%);
  will-change: transform;
}
.recording-day-timeline .timeline-record-block {
  top: 0;
  bottom: 0;
  min-width: 3px;
  background: #f4f5fb;
  opacity: .96;
}
.recording-day-timeline .timeline-events {
  position: absolute;
  inset: 0 auto 0 0;
  width: 300%;
  transform: translateX(-33.333%);
  will-change: transform;
  z-index: 4;
  pointer-events: none;
}
.recording-day-timeline .timeline-event-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  min-width: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffc144 !important;
  transform: translateX(-50%);
  z-index: 4;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 5px rgba(255,193,68,.8) !important;
}
.recording-day-timeline .timeline-selection-track {
  position: absolute;
  inset: 0;
  height: auto;
  margin: 0;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
  width: 300%;
  transform: translateX(-33.333%);
  will-change: transform;
}
.recording-day-timeline .timeline-selection-track span {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 193, 68, .65);
  border-left: 2px solid #ffc144;
  border-right: 2px solid #ffc144;
  border-radius: 0;
}
.recording-day-timeline .timeline-live-cursor {
  top: -6px;
  bottom: -6px;
  width: 2px;
  z-index: 5;
  background: #e31522;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 0 6px rgba(227,21,34,.9);
}
.recording-day-timeline .timeline-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
  pointer-events: none;
}
.recording-day-timeline .timeline-times {
  margin: 0 8px;
  color: #aeb6bf;
  font-size: 12px;
}
.recording-day-timeline .timeline-times strong {
  color: #6f2fb1;
  font-size: 13px;
}
@media (max-width: 760px) {
  .recording-day-timeline .timeline-topline {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
  }
  .recording-day-timeline .timeline-topline {
    grid-template-areas:
      "date"
      "controls";
  }
  .recording-day-timeline .timeline-day-label {
    grid-area: date;
  }
  .recording-day-timeline .timeline-selection-controls,
  .recording-day-timeline .timeline-meta-controls {
    justify-content: center;
  }
  .recording-day-timeline .timeline-selection-controls {
    grid-area: controls;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 76px 4px 0;
    scrollbar-width: none;
  }
  .recording-day-timeline .timeline-selection-controls::-webkit-scrollbar {
    display: none;
  }
  .recording-day-timeline .timeline-selection-controls button {
    flex: 0 0 auto;
    min-width: 68px;
    height: 34px;
    min-height: 34px;
    padding: 0 10px;
  }
  .recording-day-timeline .timeline-meta-controls {
    grid-area: controls;
    width: auto;
    justify-self: end;
    z-index: 1;
    pointer-events: none;
    padding-right: 0;
  }
  .recording-day-timeline .timeline-meta-controls strong {
    display: none;
  }
  .recording-day-timeline .timeline-speed {
    pointer-events: auto;
    margin-left: 8px;
    background: #111415;
    box-shadow: -10px 0 8px #111415;
  }
  .recording-day-timeline .timeline-speed select {
    width: 54px;
    height: 34px;
    min-height: 34px;
    font-size: 13px;
  }
}

/* Grade size 1 added for large single-camera viewing. */
.live-size-1 {
  grid-template-columns: minmax(0, 1fr) !important;
}
.live-size-1 .camera-card {
  max-width: 1280px;
  width: 100%;
  justify-self: center;
}
.live-size-1 .player {
  max-height: 68vh;
  object-fit: contain;
}
.portal-compact-mobile .layout-switch,
.portal-android-layout .layout-switch {
  display: flex !important;
}
.portal-compact-mobile .layout-switch button,
.portal-android-layout .layout-switch button {
  min-width: 40px !important;
}
.portal-compact-mobile .live-size-1,
.portal-android-layout .live-size-1 {
  grid-template-columns: minmax(0, 1fr) !important;
}
.portal-compact-mobile .live-size-1 .player.live-snapshot,
.portal-android-layout .live-size-1 .player.live-snapshot {
  height: auto !important;
  max-height: 42vh !important;
  aspect-ratio: 16 / 9 !important;
}
