:root {
  --bg-page: #f8fafc;
  --bg-panel: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent: #0284c7;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --emerald: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.hidden {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.brand h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.site-selector-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.topbar-site-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-site-group label {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar-menu-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-dropdown {
  position: relative;
}

.topbar-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.topbar-dropdown-trigger .caret {
  font-size: 11px;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.topbar-dropdown.open .topbar-dropdown-trigger .caret {
  transform: rotate(180deg);
}

.menu-status-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  line-height: 1.4;
}

.topbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 230px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}

.topbar-dropdown-menu-right {
  left: auto;
  right: 0;
}

.topbar-dropdown.open .topbar-dropdown-menu {
  display: flex;
}

.dropdown-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 10px 6px;
  letter-spacing: 0.2px;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.dropdown-item:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.dropdown-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dropdown-item-primary {
  color: var(--primary);
  font-weight: 600;
}

.dropdown-item-primary:hover:not(:disabled) {
  background: #eff6ff;
}

.dropdown-item-danger {
  color: var(--rose);
}

.dropdown-item-danger:hover:not(:disabled) {
  background: #fff1f2;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

select, input[type="text"], input[type="number"] {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}

select:focus, input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
  padding: 16px;
  flex: 1;
}

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

.canvas-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-switch-group {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.mode-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.view-source-group, .scan-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.chip-btn {
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}

.chip-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
  font-weight: 600;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #334155;
  color: #ffffff;
}
.btn-secondary:hover {
  background: #1e293b;
}

.btn-accent {
  background: var(--emerald);
  color: #ffffff;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}

.connection-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  flex-wrap: wrap;
  gap: 12px;
}

.conn-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conn-tag {
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.conn-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.sub-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-toolbar.hidden {
  display: none;
}

.hint-badge {
  background: var(--amber);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.hint-text {
  font-size: 12.5px;
  color: #92400e;
}

.sub-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.sub-toolbar-right input[type="number"] {
  width: 54px;
}

.status-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  flex-wrap: wrap;
  gap: 8px;
}

.kpi-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-chip {
  padding: 3px 10px;
  border-radius: 99px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  font-weight: 500;
}
.kpi-chip.occupied { border-color: #6ee7b7; background: #ecfdf5; color: #065f46; }
.kpi-chip.added { border-color: #7dd3fc; background: #f0f9ff; color: #075985; }
.kpi-chip.changed { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.kpi-chip.removed { border-color: #fda4af; background: #fff1f2; color: #9f1239; }
.kpi-chip.needs-check { border-color: #d8b4fe; background: #faf5ff; color: #7e22ce; }

.scan-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auto-scan-badge {
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}
.auto-scan-badge.idle {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.auto-scan-badge.pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  animation: pulse 1s infinite;
}
.auto-scan-badge.occluded {
  background: #fae8ff;
  color: #86198f;
  border: 1px solid #e879f9;
  animation: pulse 1.2s infinite;
}
.auto-scan-badge.offline {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.viewport-wrapper {
  position: relative;
  width: 100%;
  background: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  aspect-ratio: 16 / 9;
  user-select: none;
}

.viewport-wrapper.portrait {
  aspect-ratio: 9 / 16;
  max-width: 480px;
  margin: 0 auto;
}

.orient-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.orient-btn-group .chip-btn {
  padding: 3px 8px;
  font-size: 11.5px;
}

#cameraImage,
#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

#cameraImage.hidden,
#cameraVideo.hidden {
  display: none !important;
}

#gridCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.simulator-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.sim-title span {
  color: var(--text-muted);
  margin-left: 6px;
}

.sim-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.divider {
  color: var(--border-strong);
  margin: 0 4px;
}

.inspector-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-header h2 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.status-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg-subtle);
  color: var(--text-main);
}

.cell-sim-actions {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 9px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.sim-action-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.btn-row {
  display: flex;
  gap: 6px;
}

.btn-add { background: #0284c7; color: #fff; flex: 1; }
.btn-change { background: #d97706; color: #fff; flex: 1; }
.btn-remove { background: #e11d48; color: #fff; flex: 1; }

.score-meters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.progress-bg {
  height: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #0284c7);
  transition: width 0.25s;
}

.progress-fill.prev {
  background: linear-gradient(90deg, #f59e0b, #e11d48);
}

.crop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.crop-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  text-align: center;
}

.crop-title {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.crop-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  background: #e2e8f0;
  border: 1px solid var(--border);
}

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

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-main);
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.input-with-btn {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-with-btn input[type="text"] {
  flex: 1;
}

.conn-subbox {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.conn-subbox.hidden {
  display: none;
}

.test-status-box {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.45;
}

.webhook-preview-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.log-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.log-list {
  list-style: none;
  overflow-y: auto;
  max-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.log-list li {
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary);
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-main);
}

.log-time {
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 6px;
  font-weight: 600;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 680px;
  max-width: 94vw;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-md);
}

.modal-box.modal-sm {
  width: 460px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.modal-header h3 {
  font-size: 16px;
  color: var(--text-main);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.modal-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

#txtFrigateYaml, #txtWebhookPreview {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px;
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.sync-msg {
  font-size: 12px;
  color: var(--emerald);
  font-weight: 600;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: #0f172a;
  border-left: 4px solid #38bdf8;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: #e11d48;
  color: #ffffff;
}
.btn-danger:hover {
  background: #be123c;
}

.btn-danger-outline {
  background: #ffffff;
  color: #e11d48;
  border: 1px solid #fecdd3;
}
.btn-danger-outline:hover {
  background: #fff1f2;
  border-color: #e11d48;
  color: #be123c;
}

.delete-section-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.delete-section-box h4 {
  margin: 0 0 4px 0;
  font-size: 13.5px;
  color: var(--text-main);
}

.delete-section-box.danger-zone {
  background: #fff1f2;
  border-color: #fecdd3;
}

.delete-section-box.danger-zone h4 {
  color: #be123c;
}

.section-subdesc {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* =====================================================================
   다채널 멀티뷰 (Multi-Camera View) 스타일
   ===================================================================== */
.single-toolbar-group,
.multiview-toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mv-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  user-select: none;
}

.mv-checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

.multiview-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.multiview-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
}

.mv-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mv-badge {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
}

.mv-camera-count-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.mv-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
}

.multiview-grid {
  display: grid;
  gap: 14px;
  width: 100%;
}

.multiview-grid.layout-auto {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

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

.multiview-grid.layout-2 {
  grid-template-columns: repeat(2, 1fr);
}

.multiview-grid.layout-3 {
  grid-template-columns: repeat(3, 1fr);
}

.multiview-grid.layout-4 {
  grid-template-columns: repeat(2, 1fr);
}

.multiview-grid.layout-6 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .multiview-grid.layout-2,
  .multiview-grid.layout-3,
  .multiview-grid.layout-4,
  .multiview-grid.layout-6 {
    grid-template-columns: 1fr;
  }
}

.mv-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mv-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.mv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.mv-card-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.mv-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mv-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mv-card-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #020617;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mv-card-viewport.portrait {
  aspect-ratio: 9 / 16;
  max-height: 420px;
  margin: 0 auto;
}

.mv-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mv-card-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mv-card-overlay-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.mv-card-overlay-badge.motion {
  background: rgba(217, 119, 6, 0.9);
  color: #ffffff;
}

.mv-card-overlay-badge.occluded {
  background: rgba(124, 58, 237, 0.9);
  color: #ffffff;
}

.mv-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}

.mv-mini-kpis {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mv-mini-chip {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-muted);
}

.mv-mini-chip.occ {
  background: #ecfdf5;
  color: #059669;
}

.mv-mini-chip.emp {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.mv-mini-chip.chg {
  background: #fffbeb;
  color: #d97706;
}

.mv-card-footer-meta {
  color: var(--text-muted);
  font-size: 11px;
}

/* 멀티뷰 인스펙터 패널 */
.mv-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.mv-stat-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mv-stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.mv-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.mv-stat-box.occupied .mv-stat-val {
  color: var(--emerald);
}

.mv-stat-box.empty .mv-stat-val {
  color: #64748b;
}

.mv-stat-box.changed .mv-stat-val {
  color: var(--amber);
}

.mv-camera-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.mv-camera-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: 0.15s;
}

.mv-camera-item:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.mv-cam-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mv-cam-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mv-cam-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
}

.mv-cam-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* =====================================================================
   AI 학습 데이터셋 정리 모달 · 일괄 선택/처리 & 페이지네이션
   ===================================================================== */
.ds-batch-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.ds-batch-left,
.ds-batch-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ds-select-page-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-weight: 600;
  color: #1e293b;
  user-select: none;
}

.ds-selected-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11.5px;
}

.ds-shift-hint {
  font-size: 11px;
  color: #64748b;
}

.ds-batch-progress {
  font-size: 11.5px;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 2px 8px;
}

.ds-card {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
}

.ds-card.ds-card-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.ds-card-img-wrap {
  position: relative;
  cursor: pointer;
}

.ds-card-img-wrap img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  display: block;
}

.ds-card-check {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #2563eb;
  flex-shrink: 0;
}

.ds-pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
}

.ds-page-left,
.ds-page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ds-page-size-select {
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
}

.ds-page-info {
  color: #475569;
  font-size: 11.5px;
}

.ds-page-num {
  font-weight: 700;
  color: #1e293b;
  min-width: 56px;
  text-align: center;
}

/* 다단계 라벨 폴더 트리 레이아웃 */
.ds-workspace-split {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 820px) {
  .ds-workspace-split {
    grid-template-columns: 1fr;
  }
}

.ds-folder-tree-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 510px;
}

.ds-folder-tree-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
}

.ds-folder-add-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ds-folder-add-row input {
  flex: 1;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11.5px;
  background: #fff;
}

.ds-active-multilabel-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  color: #1e3a8a;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ds-folder-tree {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 2px;
}

.ds-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #334155;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.ds-tree-children {
  margin-left: 11px;
  padding-left: 6px;
  border-left: 1.5px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ds-tree-children.collapsed {
  display: none;
}

.ds-tree-toggle {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #64748b;
  border-radius: 3px;
  flex-shrink: 0;
  user-select: none;
}

.ds-tree-toggle:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.ds-tree-row:hover {
  background: #e2e8f0;
}

.ds-tree-row.active {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e40af;
  font-weight: 600;
}

.ds-tree-name-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.ds-tree-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-tree-count {
  font-size: 10.5px;
  color: #64748b;
  background: #e2e8f0;
  border-radius: 10px;
  padding: 0 6px;
  flex-shrink: 0;
}

.ds-tree-row.active .ds-tree-count {
  background: #bfdbfe;
  color: #1e40af;
}

.ds-tree-actions {
  display: inline-flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.72;
}

.ds-tree-row:hover .ds-tree-actions,
.ds-tree-row.active .ds-tree-actions {
  opacity: 1;
}

.ds-tree-act-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10.5px;
  cursor: pointer;
  line-height: 1.3;
}

.ds-tree-act-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.ds-tree-act-btn.danger:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

.ds-gallery-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ds-train-chk {
  margin: 0 2px 0 0;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.ds-tree-row.train-excluded .ds-tree-name {
  opacity: 0.48;
  text-decoration: line-through;
}

.ds-train-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 12px;
}

.ds-train-summary-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.ds-train-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 600;
}

.ds-train-badge.excluded {
  background: #f1f5f9;
  color: #64748b;
  text-decoration: line-through;
}

.ai-train-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.ai-train-folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 11.5px;
}

.ai-train-folder-item.excluded {
  opacity: 0.6;
  background: #f1f5f9;
}

.ai-train-folder-item label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.ai-train-folder-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #1e293b;
}

.ai-train-folder-cnt {
  color: #64748b;
  font-size: 11px;
  flex-shrink: 0;
}

.ai-train-alias-input {
  width: 92px;
  padding: 2px 5px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
}

/* =========================================================
   패스워드 인증 게이트 & 일회용 패스워드(OTP) 세션 관리 UI
   ========================================================= */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.98));
  backdrop-filter: blur(10px);
}

.auth-gate-overlay.hidden {
  display: none;
}

.auth-gate-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 16px;
  padding: 28px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  border: 1px solid #e2e8f0;
  text-align: center;
}

.auth-gate-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.auth-gate-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.auth-gate-desc {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}

.auth-gate-notice {
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.auth-gate-notice.hidden {
  display: none;
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-gate-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-gate-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-gate-submit {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
}

.auth-gate-footnote {
  margin-top: 14px;
  font-size: 11.5px;
  color: #64748b;
}

.otp-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  white-space: nowrap;
}

.otp-session-badge.warning {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.otp-session-badge.hidden {
  display: none;
}

.otp-create-box {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.otp-create-box input {
  flex: 1;
  min-width: 220px;
  padding: 8px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
}

.otp-created-box {
  background: #ecfdf5;
  border: 1.5px solid #6ee7b7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.otp-created-box.hidden {
  display: none;
}

.otp-created-label {
  font-size: 12px;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 6px;
}

.otp-created-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.otp-created-code {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #047857;
  background: #ffffff;
  border: 1px solid #a7f3d0;
  padding: 5px 14px;
  border-radius: 8px;
}

.otp-created-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: #047857;
}

.otp-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #1e293b;
}

.otp-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
}

.otp-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12.5px;
}

.otp-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.otp-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #0f172a;
}

.otp-item-meta {
  font-size: 11.5px;
  color: #64748b;
}

.otp-status-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.otp-status-pill.unused {
  background: #dbeafe;
  color: #1d4ed8;
}

.otp-status-pill.active {
  background: #fef3c7;
  color: #b45309;
}

.otp-status-pill.done {
  background: #e2e8f0;
  color: #475569;
}




