:root {
  --bg: #0f172a;
  --bg-panel: rgba(30, 41, 59, 0.9);
  --bg-card: rgba(15, 23, 42, 0.55);
  --accent: #60a5fa;
  --accent-strong: #2563eb;
  --text: #e2e8f0;
  --text-subtle: #94a3b8;
  --border: rgba(148, 163, 184, 0.2);
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.4);
  --success: #34d399;
  --danger: #f87171;
  --warn: #facc15;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1e293b, #0f172a 55%);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.app-header h1 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--text);
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-subtle);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--text-subtle);
}

.header-dropdown {
  position: relative;
}

.header-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.header-dropdown__chevron {
  font-size: 0.75rem;
  opacity: 0.8;
}

.header-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 220px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0;
  flex-direction: column;
  z-index: 20;
}

.header-dropdown__menu a {
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  display: block;
}

.header-dropdown__menu a:hover {
  background: rgba(96, 165, 250, 0.2);
}

.header-dropdown.header-dropdown--open .header-dropdown__menu,
.header-dropdown:focus-within .header-dropdown__menu,
.header-dropdown:hover .header-dropdown__menu {
  display: flex;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  flex: 1;
}

.admin-layout {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  grid-auto-flow: dense;
  align-items: start;
}

.panel--wide {
  grid-column: span 2;
}

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

.panel-group-label {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0.25rem 0.5rem;
}

.panel--compact {
  padding: 1rem 1.25rem;
}

.admin-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 2rem;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border);
}

.admin-nav__item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 0.2rem 0.6rem 0.2rem 0.9rem;
}

.admin-nav__item.is-collapsed {
  opacity: 0.6;
}

.admin-nav__link {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.admin-nav__link:hover {
  color: var(--accent);
}

.admin-nav__toggle {
  width: 28px;
  height: 28px;
  margin-left: 0;
}

.admin-nav__toggle::before {
  content: '–';
  border: none;
  width: auto;
  height: auto;
  font-size: 1rem;
  line-height: 1;
}

.admin-nav__toggle::after {
  display: none;
}

.admin-nav__item.is-collapsed .admin-nav__toggle::before {
  content: '+';
}

.admin-nav__group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-right: 1rem;
}

.admin-nav__group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-right: 0.25rem;
}

.panel {
  background: var(--bg-panel);
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel.is-collapsed .panel-body {
  display: none;
}

.panel-toggle {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  padding-bottom: 1.5rem;
}

.panel-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.panel-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent);
}

.field-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.field-label--inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
}

.field-select,
.field-input,
.field-textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
}

.field-input--search {
  background: rgba(15, 23, 42, 0.45);
  max-width: 220px;
}

.field-textarea {
  resize: vertical;
}

.field-select--compact {
  width: auto;
  min-width: 140px;
  padding: 0.4rem 0.6rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.training-quick {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.training-quick label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #94a3b8;
}

.training-quick label span {
  margin-bottom: 0.15rem;
  font-weight: 600;
  color: #e2e8f0;
}

.btn--compact {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.event-card__actions {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tagged-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  background: #1d4ed8;
  color: #e0f2fe;
}

.dataset-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.dataset-breakdown {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.dataset-breakdown li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.1rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.dataset-breakdown li strong {
  font-weight: 600;
  color: #e2e8f0;
}

.dataset-breakdown li span {
  color: #94a3b8;
}

.training-card__actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.training-annotate {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.training-annotate__preview {
  flex: 1 1 320px;
}

.training-annotate__preview img {
  width: 100%;
  border-radius: 12px;
  background: #0f172a;
}

.training-annotate form {
  flex: 1 1 320px;
  min-width: 280px;
}

.session-debug {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.auth-body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e2f4a, #0b1526 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: rgba(15, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(5, 10, 20, 0.35);
  color: #f8fafc;
}

.auth-card .subtitle {
  margin-bottom: 1.5rem;
}

.auth-form .field-label {
  display: block;
  margin-bottom: 1rem;
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.secret-input {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.secret-input .field-input {
  flex: 1;
}

.secret-value {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

.muted {
  color: var(--text-subtle);
  font-style: italic;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.snapshot-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 1rem;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 120px;
}

.snapshot-card--wide {
  grid-column: span 2;
}

.snapshot-card__label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.snapshot-card__value {
  font-size: 1.3rem;
  font-weight: 600;
}

.snapshot-card__value.is-on {
  color: var(--success);
}

.snapshot-card__value.is-off {
  color: var(--warn);
}

.snapshot-card__meta {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.snapshot-card__prompt {
  margin: 0;
  line-height: 1.4;
  color: var(--text);
  max-height: 3.2em;
  overflow: hidden;
}

@media (max-width: 640px) {
  .snapshot-card--wide {
    grid-column: span 1;
  }
}

.status-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.status-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.status-card.is-muted {
  opacity: 0.6;
}

.status-card__title {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

.status-card__value {
  font-size: 1.2rem;
  font-weight: 600;
}

.status-card__value.is-on {
  color: var(--success);
}

.status-card__value.is-off {
  color: var(--warn);
}

.status-card__meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel--wide,
  .panel--full {
    grid-column: span 1;
  }
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
}

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

.btn--ghost {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.4rem;
  color: var(--text-subtle);
  position: relative;
}

.icon-button::before {
  content: '';
  width: 16px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 999px;
  display: block;
}

.icon-button::after {
  content: '';
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.icon-button.is-active,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(148, 163, 184, 0.35);
  transition: 0.3s;
  border-radius: 30px;
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked+.toggle-slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(22px);
}

.toggle--inline {
  margin-left: auto;
}

.toggle-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toggle-title {
  font-weight: 600;
}

.toggle-sub {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.1);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(96, 165, 250, 0.12);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.section-header h2 {
  margin: 0;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 20px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: transform 0.2s ease, border 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card__title {
  margin: 0;
  font-size: 1.1rem;
}

.card__subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card__image {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.camera-thumb {
  width: 100%;
  border-radius: 14px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.camera-thumb--empty {
  object-fit: contain;
}

.card__meta-line {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-subtle);
}

.card__footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.assign-face {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 0;
}

.assign-face select {
  flex: 1;
}

.assign-face .btn {
  flex-shrink: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-subtle);
}

.status-dot--online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
}

.status-dot--offline {
  background: var(--danger);
}

.pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-size: 0.85rem;
}

.pill--inline {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
}

.pill--success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.pill--muted {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.35);
  color: rgba(226, 232, 240, 0.75);
}

.pill--outline {
  background: transparent;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text-subtle);
}

.pill--success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.pill--outline {
  background: transparent;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text-subtle);
}

.event-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 1rem;
}

.event-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.event-card__meta h3 {
  margin: 0;
  font-size: 1rem;
}

.event-card__time {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.event-card__body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.event-card__thumb {
  width: 120px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  cursor: zoom-in;
}

.event-card__text {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.event-card__text p {
  margin: 0;
  font-size: 0.9rem;
}

.event-card__caption {
  color: var(--text-subtle);
  font-style: italic;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.summary-card {
  background: rgba(15, 23, 42, 0.55);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 1rem;
}

.summary-card--empty {
  border-style: dashed;
  opacity: 0.85;
}

.summary-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.summary-card h3 {
  margin: 0 0 0.5rem;
  color: var(--accent);
}

.summary-card__status {
  display: block;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.summary-card__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.summary-card__count {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
  font-weight: 600;
}

.summary-refresh::before {
  content: '\\21bb';
  width: auto;
  height: auto;
  border: none;
  background: none;
  font-size: 1rem;
  line-height: 1;
}

.summary-refresh::after {
  display: none;
}

.summary-card__text {
  margin: 0;
  color: var(--text-subtle);
  line-height: 1.4;
}

.summary-card__meta {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.summary-card p {
  margin: 0;
  color: var(--text-subtle);
  line-height: 1.5;
}

.live-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.live-frame {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.6);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-feedback {
  padding: 0.75rem 2rem 0;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.feedback {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  display: inline-block;
}

.feedback--success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.feedback--error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.feedback--warn {
  background: rgba(250, 204, 21, 0.15);
  color: var(--warn);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.alert--warn {
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: var(--warn);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.alert--warn {
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: var(--warn);
}

.console {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
  max-height: 120px;
  overflow: hidden;
}

.console--small {
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

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

.btn--compact {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}

.admin-collection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
}

.admin-card--muted {
  opacity: 0.7;
}

.admin-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-card__actions {
  display: flex;
  gap: 0.5rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.env-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.env-table__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.env-table th,
.env-table td {
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.env-table th {
  background: rgba(15, 23, 42, 0.6);
}

.env-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.env-form__fields {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.env-form__fields label {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.env-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.env-form__actions .help-text {
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.data-table th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.data-table tr.is-focus {
  background: rgba(96, 165, 250, 0.08);
}

.status-dot--disconnected {
  background: var(--danger);
}

.empty-state {
  text-align: center;
  color: var(--text-subtle);
  padding: 1rem;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.2);
}

.hidden {
  display: none !important;
}

.prompt-template-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prompt-template-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prompt-template-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.prompt-template-card__actions {
  display: flex;
  gap: 0.5rem;
}

.prompt-template-card__description {
  margin: 0;
  color: var(--text-subtle);
}

.prompt-template-form .button-row {
  margin-top: 0.5rem;
}

.twilio-form .button-row {
  margin-top: 0.5rem;
}

.tab-switcher {
  display: inline-flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  padding: 0.25rem;
}

.tab-switcher__button {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 0.85rem;
}

.tab-switcher__button.is-active {
  background: rgba(96, 165, 250, 0.2);
  color: var(--text);
}

.tab-switcher__button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.tab-panel.is-active {
  display: flex;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.modal__content {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 20px;
  padding: 1rem;
  position: relative;
  max-width: 80vw;
  max-height: 80vh;
}

.modal__body img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: rgba(148, 163, 184, 0.25);
  color: var(--text);
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

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

  .panel--activity {
    display: none;
  }
}

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

  .panel--controls {
    order: 2;
  }

  .main-content {
    order: 1;
  }
}

.modal__content--wide {
  max-width: 960px;
  width: 90%;
}

.modal__content--xwide {
  max-width: 1120px;
  width: 92%;
}

.modal__body--scroll {
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detection-page .admin-layout {
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
}

.detection-page .detection-settings .panel-section,
.detection-page .detection-settings .field-group,
.detection-page .detection-settings .toggle-row {
  width: 100%;
}

.detection-page .detection-settings .field-group input,
.detection-page .detection-settings .field-group select,
.detection-page .detection-settings .field-group textarea {
  width: 100%;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.metrics-card {
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.4);
}

.metrics-card__title {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-subtle);
}

.metrics-card__value {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.metrics-card__meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.profile-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-card {
  flex: 1 1 240px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  color: inherit;
  text-align: left;
  padding: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.profile-card:hover {
  border-color: rgba(96, 165, 250, 0.5);
}

.profile-card--active {
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2);
}

.profile-card__title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.lab-layout {
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: 2fr 320px;
  gap: 1.5rem;
}

.lab-project-panel {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lab-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.lab-feedback--info {
  color: var(--text-subtle);
}

.lab-feedback--success {
  color: #34d399;
}

.lab-feedback--warn {
  color: #fbbf24;
}

.lab-feedback--error {
  color: #f87171;
}

.lab-catalog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
}

.lab-catalog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.lab-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.lab-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.lab-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 0.9rem;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lab-card__thumb {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.6);
  background-size: cover;
  background-position: center;
}

.lab-card--active {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2);
}

.lab-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.lab-card__meta {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.lab-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.lab-card__badge {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

.lab-assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lab-suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lab-suggestion {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.lab-ai-helper {
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lab-ai-answer {
  min-height: 48px;
  white-space: pre-wrap;
}

.lab-context {
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lab-detail {
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.lab-tab {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: rgba(15, 23, 42, 0.4);
  color: inherit;
  cursor: pointer;
  font-size: 0.9rem;
}

.lab-tab--active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.6);
  color: #bfdbfe;
}

.lab-tab__close {
  border: none;
  background: transparent;
  color: inherit;
  margin-left: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.lab-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.75);
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lab-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.lab-panel__meta {
  font-size: 0.85rem;
  color: var(--text-subtle);
  display: flex;
  gap: 1rem;
}

.lab-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.lab-preview {
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 1rem;
  min-height: 120px;
  font-size: 0.9rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.lab-preview--img {
  background-size: cover;
  background-position: center;
  border-style: solid;
  color: transparent;
}

.lab-mask-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.lab-mask-sample {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mask-preview-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 0.5rem;
}

.mask-preview__canvas {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.4);
}

.profile-card__meta {
  display: block;
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 0.35rem;
}

.profile-card__tags {
  font-size: 0.75rem;
  color: var(--text-subtle);
  opacity: 0.9;
}

.panel-head--stack {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-controls .field-select {
  min-width: 160px;
}

.training-admin {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  min-height: 540px;
}

.training-admin__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.training-admin__detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.training-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.training-section__title {
  margin: 0;
  font-size: 1.1rem;
}

.training-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.training-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.training-item {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.training-item--workflow {
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.training-item--workflow:hover {
  border-color: rgba(96, 165, 250, 0.45);
}

.training-item--active {
  border-color: rgba(96, 165, 250, 0.65);
  background: rgba(37, 99, 235, 0.15);
}

.training-item__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.training-item__meta {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.training-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.training-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.training-form input,
.training-form textarea,
.training-form select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  color: var(--text);
  padding: 0.6rem;
}

details.collapsible {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: rgba(15, 23, 42, 0.5);
}

details.collapsible+details.collapsible {
  margin-top: 0.75rem;
}

details.collapsible summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

details.collapsible summary::after {
  content: '▾';
  margin-left: auto;
  transition: transform 0.2s ease;
}

details.collapsible[open] summary::after {
  transform: rotate(180deg);
}

.collapsible__content {
  margin-top: 0.75rem;
}

.training-form textarea {
  resize: vertical;
}

.training-form--inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.btn--block {
  width: 100%;
  text-align: center;
}

.training-detail {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.training-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.training-detail__meta {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.training-pre {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 0.8rem;
  max-height: 220px;
  overflow: auto;
}

.training-collection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.training-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 0.85rem;
}

.training-card__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.training-card__meta {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.empty-copy {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.training-detail .pill {
  align-self: flex-start;
}

.training-detail .pill[data-state='training'] {
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
}

.training-detail .pill[data-state='idle'] {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-subtle);
}

@media (max-width: 1140px) {
  .training-admin {
    grid-template-columns: 1fr;
  }
}

.modal-title {
  margin: 0;
  font-size: 1.4rem;
}

.modal-subtitle {
  margin: 0;
  color: var(--text-subtle);
}

.camera-admin-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.camera-config-form {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.camera-config-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.camera-config-header h3 {
  margin: 0;
}

.camera-config-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.camera-config-status {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-subtle);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.camera-config-status--online {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

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

.camera-config-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.camera-config-grid input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 0.6rem;
  color: var(--text);
}

.camera-config-grid input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.camera-config-actions {
  display: flex;
  justify-content: flex-end;
}

.camera-admin-new {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.camera-admin-new h3 {
  margin: 0;
}

.camera-config-form--new {
  background: rgba(37, 99, 235, 0.08);
  border: 1px dashed rgba(96, 165, 250, 0.35);
}

.camera-config-form--new button {
  align-self: flex-end;
}

.twilio-config {
  display: grid;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (min-width: 900px) {
  .twilio-config {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.twilio-form h3 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.twilio-form .button-row {
  margin-top: 0.75rem;
}

.status-grid {
  display: grid;
  gap: 1rem;
}

.status-grid__section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
}

.status-grid__section h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.status-grid__item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.status-grid__list {
  display: grid;
  gap: 0.5rem;
}

.status-grid__footer {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  width: fit-content;
}

.badge--success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge--warn {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.badge--error {
  background: rgba(248, 113, 113, 0.18);
  color: #f87171;
}

.scenario-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  padding-bottom: 140px;
}

.scenario-filters {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: var(--bg-card);
  border-radius: 18px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.scenario-source-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.source-chip {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.4);
  user-select: none;
}

.source-chip--active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.6);
  color: #bfdbfe;
}

.scenario-catalog {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 1rem;
}

.scenario-catalog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.scenario-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.55);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.scenario-card__thumb {
  width: 100%;
  height: 120px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(30, 41, 59, 0.6);
}

.scenario-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.scenario-card__meta {
  font-size: 0.8rem;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.scenario-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.scenario-card__tag {
  font-size: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.scenario-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.scenario-recommendations {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scenario-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scenario-selection {
  position: sticky;
  bottom: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 1rem;
  align-items: center;
}

.scenario-selection__list {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scenario-selection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
}

.scenario-selection-item__meta {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.scenario-selection-item__controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.scenario-selection__actions {
  display: flex;
  justify-content: flex-end;
}

.profile-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.scenario-targets {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-stack--full {
  grid-column: span 2;
}

.scenario-camera-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 48px;
}

.scenario-camera-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.scenario-camera-chip--active {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.6);
}

.field-select--compact {
  min-height: 32px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

.scenario-card--suggested {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.scenario-suggestion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.scenario-card__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.7);
}

.profile-card {
  flex: 1 1 240px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  color: inherit;
  text-align: left;
  padding: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.profile-card:hover {
  border-color: rgba(96, 165, 250, 0.5);
}

.profile-card--active {
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2);
}

.profile-card__title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-card__meta {
  display: block;
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 0.35rem;
}

.profile-card__tags {
  font-size: 0.75rem;
  color: var(--text-subtle);
  opacity: 0.9;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }

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

  .panel--wide,
  .panel--full {
    grid-column: 1 / -1;
  }

  .panel {
    padding: 1rem;
  }

  .app-header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .header-meta {
    width: 100%;
    justify-content: space-between;
    order: 2;
  }
}

/* Smart Features Modal specific styles */
.modal-content--wide {
  max-width: 900px;
  width: 95%;
}

.feature-editor {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.canvas-wrapper {
  position: relative;
  flex: 1 1 500px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#featureCanvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.feature-loading {
  position: absolute;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.feature-controls {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.control-group h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.line-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.3);
}

.line-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.line-list li:last-child {
  border-bottom: none;
}

.line-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-remove-line {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.9rem;
}

.btn-remove-line:hover {
  text-decoration: underline;
}

/* CPU Budget Meter */
.lab-cpu-meter {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lab-cpu-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.lab-cpu-track {
  height: 8px;
  background: var(--bg-surface-1);
  border-radius: 4px;
  overflow: hidden;
}

.lab-cpu-bar {
  height: 100%;
  background: var(--color-success);
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.lab-cpu-bar.warning {
  background: var(--color-warning);
}

.lab-cpu-bar.critical {
  background: var(--color-danger);
}

/* Modal Enhancements for Lab */
.lab-camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--bg-surface-1);
  border-radius: var(--radius-sm);
}

.lab-camera-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
}

.lab-camera-option:hover {
  border-color: var(--color-primary);
}

.lab-camera-option input {
  cursor: pointer;
}