* { box-sizing: border-box; }
body { font-family: Arial; margin: 0; background: #f0f2f5; }
body.auth-locked { overflow: hidden; }
body.auth-booting #app-shell,
body.auth-booting #app-tabs {
  visibility: hidden;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #1a1a2e; color: #fff;
  padding: 10px 16px; font-size: 15px;
  position: relative;
  gap: 12px;
}
.brand { font-weight: bold; font-size: 17px; flex: 0 0 auto; }
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}
.topbar-btn {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
}
.topbar-btn:hover { background: rgba(255,255,255,.14); }
#conn-status { font-size: 12px; color: #aaa; }
#conn-status.connected { color: #4ade80; }
#sys-status { font-size: 12px; color: #cbd5e1; }

/* ── Tabs ── */
.tabs {
  display: flex; overflow-x: auto; gap: 2px;
  background: #12122a; padding: 6px 10px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; font-size: 13px; padding: 6px 14px;
  border-radius: 8px; border: none;
  background: transparent; color: #aaa; cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: #ffffff18; color: #fff; }
.tab.active { background: #3b82f6; color: #fff; font-weight: bold; }
.tab-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148,255,163,.18);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
}
.tab-status-badge.ok { background: rgba(34, 197, 94, .22); color: #bbf7d0; }
.tab-status-badge.warn { background: rgba(245, 158, 11, .22); color: #fde68a; }
.tab-status-badge.err { background: rgba(239, 68, 68, .22); color: #fecaca; }

/* ── Tab content ── */
.tab-content { padding: 14px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Cards ── */
.card {
  background: #fff; border: 1px solid #dde;
  border-radius: 12px; padding: 14px;
  margin-bottom: 10px;
}
.wrap { display: flex; gap: 12px; flex-wrap: wrap; }
.ctrl { flex: 1; min-width: 300px; max-width: 480px; }

/* ── Controls ── */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pad { display: grid; grid-template-columns: repeat(3, 88px); gap: 10px; margin-top: 10px; }

button {
  font-size: 15px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid #ccc; background: #f5f5f5; cursor: pointer;
  transition: background 0.15s;
}
button:hover  { background: #e8e8e8; }
button:active { transform: scale(0.97); }
button.danger  { background: #fee2e2; border-color: #fca5a5; }
button.primary { background: #dbeafe; border-color: #93c5fd; }

input, select {
  font-size: 14px; padding: 6px 8px;
  border-radius: 8px; border: 1px solid #ccc;
}
input[type=number] { width: 72px; }

.hint { color: #888; font-size: 12px; margin-top: 6px; }
.control-audio-card { padding: 12px 14px; border-radius: 14px; border: 1px solid #dbe5f4; background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%); }
.control-audio-status { margin-top: 4px; font-size: 12px; color: #5b6472; }
.control-audio-toggles { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: #435063; }
.control-audio-toggles label { display: flex; align-items: center; gap: 6px; }
.control-audio-meter { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; margin-top: 12px; }
.control-audio-meter-label { font-size: 12px; color: #526072; }
.control-audio-meter-bar { height: 10px; border-radius: 999px; background: #dbe7f8; overflow: hidden; }
.control-audio-meter-bar span { display: block; height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #22c55e 0%, #f59e0b 60%, #ef4444 100%); transition: width .12s ease; }

.cam-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 240px;
  max-height: min(70vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
}
.cam-frame > iframe,
.cam-frame > img {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #0f172a;
}
.cam-frame > img {
  object-fit: contain;
}

/* ── Log ── */
.log {
  margin-top: 10px; font-size: 12px; font-family: monospace;
  white-space: pre-wrap; max-height: 180px; overflow: auto;
  border: 1px solid #eee; border-radius: 10px;
  padding: 8px; background: #fafafa;
}

/* ── Alarm items ── */
.alarm-item {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; border: 1px solid #eee;
  border-radius: 10px; margin-top: 8px; flex-wrap: wrap;
}
.alarm-item.disabled { opacity: 0.4; }
.days label { font-size: 12px; margin-right: 4px; }

/* ── Sub-tabs ── */
.subtabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.subtab {
  font-size: 13px; padding: 6px 12px;
  border-radius: 8px; border: 1px solid #ddd;
  background: #f5f5f5; cursor: pointer;
}
.subtab.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.subtab-pane { display: none; }
.subtab-pane.active { display: block; }

.config-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.config-nav {
  position: sticky;
  top: 14px;
}
.config-nav-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.config-nav-subtitle {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}
.config-subtabs {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.config-subtab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.config-subtab.active {
  background: linear-gradient(180deg, #dbeafe, #eff6ff);
  border-color: #93c5fd;
  color: #1d4ed8;
}
.config-subtab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}
.config-subtab-badge.ok { background: #dcfce7; color: #166534; }
.config-subtab-badge.warn { background: #fef3c7; color: #92400e; }
.config-subtab-badge.err { background: #fee2e2; color: #b91c1c; }
.config-main {
  min-width: 0;
}
.config-pane {
  display: none;
}
.config-pane.active {
  display: block;
}
.config-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.config-card-kicker {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
}
.config-card-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
  color: #0f172a;
}
.config-card-note {
  max-width: 360px;
  font-size: 12px;
  line-height: 1.55;
  color: #64748b;
}

/* ── Coming soon ── */
.coming-soon {
  text-align: center; padding: 60px 20px;
  color: #aaa; max-width: 400px;
}
.coming-soon span { font-size: 48px; }
.coming-soon p { font-size: 15px; margin-top: 10px; }

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.24), transparent 32%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.22), transparent 28%),
    rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(12px);
}
.auth-card {
  width: min(100%, 880px);
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}
.auth-head h2 { margin: 6px 0 0; font-size: 30px; color: #0f172a; }
.auth-head p { margin: 10px 0 0; color: #475569; line-height: 1.55; }
.auth-kicker {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
}
.auth-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 13px;
}
.auth-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.auth-account-card {
  padding: 16px 14px;
  border-radius: 20px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff, #f8fbff);
  display: grid;
  justify-items: center;
  gap: 10px;
}
.auth-account-card.active {
  border-color: #2563eb;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18);
}
.auth-avatar,
.accounts-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}
.auth-avatar.large {
  width: 62px;
  height: 62px;
  font-size: 22px;
}
.auth-password-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
}
.auth-selected {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-empty,
.accounts-empty {
  padding: 18px;
  border-radius: 16px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.accounts-layout { display: grid; gap: 14px; }
.accounts-shell { padding: 18px; }
.accounts-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.accounts-kicker {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 700;
  color: #0ea5e9;
}
.accounts-header h3 { margin: 6px 0 0; }
.accounts-copy { margin: 8px 0 0; color: #64748b; }
.accounts-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
}
.accounts-list { display: grid; gap: 10px; }
.accounts-item {
  width: 100%;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff, #f8fbff);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.accounts-item.active {
  border-color: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.16);
}
.accounts-item-body { display: grid; gap: 4px; }
.accounts-item-body small { color: #64748b; }
.accounts-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.accounts-field { display: grid; gap: 6px; }
.accounts-field span,
.accounts-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #334155;
}
.accounts-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.accounts-learner-summary {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #eff6ff, #f8fbff);
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 600;
}
.accounts-create-learner {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
}
.accounts-toggle,
.accounts-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.accounts-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.accounts-check {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: #fff;
}
.accounts-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .pad { grid-template-columns: repeat(3, 76px); }
  .topbar { min-height: 56px; }
  .topbar {
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .topbar-overlay { padding-top: 0; }
  .auth-card { padding: 20px; }
  .auth-head h2 { font-size: 24px; }
  .accounts-grid { grid-template-columns: 1fr; }
}

/* Alarm dashboard */
.alarm-layout {
  display: grid;
  gap: 14px;
}
.alarm-hero {
  color: #e5eef7;
  background:
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.22), transparent 28%),
    linear-gradient(135deg, #10223d, #153b5f 58%, #1f6d8b);
  border: 0;
}
.alarm-hero-head,
.alarm-main-grid,
.alarm-builder-grid,
.alarm-section-head,
.alarm-item-main,
.alarm-item-actions,
.alarm-session-card,
.alarm-motion-row {
  display: flex;
  gap: 12px;
}
.alarm-hero-head,
.alarm-section-head,
.alarm-item-main,
.alarm-session-card,
.alarm-motion-row {
  align-items: center;
  justify-content: space-between;
}
.alarm-hero h2,
.alarm-section-head h3 {
  margin: 4px 0 0;
}
.alarm-hero p {
  margin: 10px 0 0;
  max-width: 640px;
  color: rgba(229, 238, 247, 0.82);
}
.alarm-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
  color: #fcd34d;
}
.alarm-next {
  min-width: 220px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}
.alarm-next-label,
.alarm-stat-title,
.alarm-chart-head span,
.alarm-builder-hint,
.alarm-session-meta,
.alarm-motion-copy span,
.alarm-day-meta,
.alarm-item-meta {
  font-size: 12px;
  color: #6b7280;
}
.alarm-hero .alarm-next-label,
.alarm-hero .alarm-next-meta,
.alarm-hero .alarm-stat-title,
.alarm-hero .alarm-stat-foot {
  color: rgba(229, 238, 247, 0.76);
}
.alarm-next-time {
  margin: 8px 0 6px;
  font-size: 34px;
  font-weight: 700;
}
.alarm-status-bar {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.35);
  align-items: center;
  gap: 14px;
}
.alarm-status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  animation: alarmPulse 0.9s ease-in-out infinite alternate;
}
.alarm-status-copy {
  flex: 1;
}
.alarm-status-label {
  font-weight: 700;
  color: #fff;
}
.alarm-status-ring {
  margin-top: 4px;
  color: #fecaca;
  font-size: 13px;
}
.alarm-stat-grid,
.alarm-day-grid {
  display: grid;
  gap: 10px;
}
.alarm-stat-grid {
  margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.alarm-stat-card,
.alarm-chart-card,
.alarm-session-card,
.alarm-item,
.alarm-edit-panel {
  border-radius: 16px;
}
.alarm-stat-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.alarm-stat-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
  color: #fff;
}
.alarm-main-grid {
  align-items: flex-start;
  flex-wrap: wrap;
}
.alarm-builder-card,
.alarm-analytics-card {
  flex: 1;
  min-width: 320px;
}
.alarm-builder-grid {
  flex-wrap: wrap;
}
.alarm-builder-grid > * {
  flex: 1;
  min-width: 180px;
}
.alarm-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.alarm-field > span {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.alarm-field input,
.alarm-field select,
.alarm-field textarea,
.alarm-builder-card input,
.alarm-builder-card select {
  width: 100%;
}
.alarm-segment {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.alarm-segment label,
.alarm-toggle,
.alarm-day-grid label,
.alarm-switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  font-size: 13px;
}
.alarm-day-grid {
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
}
.alarm-builder-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.alarm-builder-hint {
  flex: 1;
  min-width: 220px;
}
.alarm-chart-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}
.alarm-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.alarm-daily-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  min-height: 190px;
  align-items: end;
}
.alarm-day-col {
  text-align: center;
}
.alarm-bar-stack {
  height: 120px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
}
.alarm-bar {
  width: 12px;
  border-radius: 999px 999px 4px 4px;
  display: inline-block;
}
.alarm-bar.fired { background: #94a3b8; }
.alarm-bar.motion { background: #22c55e; }
.alarm-bar.manual { background: #f59e0b; }
.alarm-day-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}
.alarm-motion-chart {
  display: grid;
  gap: 10px;
}
.alarm-motion-bar {
  flex: 1;
  min-width: 120px;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}
.alarm-motion-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #64748b;
}
.alarm-motion-fill.good { background: linear-gradient(90deg, #22c55e, #10b981); }
.alarm-motion-fill.warn { background: linear-gradient(90deg, #f59e0b, #fb7185); }
.alarm-motion-fill.bad { background: linear-gradient(90deg, #ef4444, #f97316); }
.alarm-motion-fill.live { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.alarm-motion-copy {
  min-width: 170px;
  display: grid;
}
.alarm-motion-score {
  width: 56px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.alarm-session-list,
.alarm-yt-results {
  display: grid;
  gap: 10px;
}
.alarm-session-card,
.alarm-item {
  padding: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.alarm-session-side {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: #64748b;
  font-size: 12px;
}
.alarm-session-title,
.alarm-item-time {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.alarm-item {
  margin-top: 10px;
}
.alarm-item-main {
  flex-wrap: wrap;
}
.alarm-item-copy {
  flex: 1;
  min-width: 180px;
}
.alarm-item-title-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.alarm-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #dbeafe;
  color: #1d4ed8;
}
.alarm-chip.ghost {
  background: #ecfeff;
  color: #0f766e;
}
.alarm-chip.good {
  background: #dcfce7;
  color: #15803d;
}
.alarm-chip.warn {
  background: #fef3c7;
  color: #b45309;
}
.alarm-chip.bad {
  background: #fee2e2;
  color: #b91c1c;
}
.alarm-chip.live {
  background: #dbeafe;
  color: #1d4ed8;
}
.alarm-item-actions {
  flex-wrap: wrap;
}
.alarm-edit-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.alarm-empty {
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #94a3b8;
  background: #f8fafc;
  font-size: 13px;
}
.alarm-yt-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}
@keyframes alarmPulse {
  from { transform: scale(0.94); }
  to { transform: scale(1.05); }
}
@media (max-width: 720px) {
  .alarm-hero-head,
  .alarm-main-grid,
  .alarm-section-head,
  .alarm-session-card,
  .alarm-motion-row {
    flex-direction: column;
    align-items: stretch;
  }
  .alarm-next,
  .alarm-motion-copy,
  .alarm-session-side {
    min-width: 0;
    width: 100%;
  }
  .alarm-session-side {
    justify-items: start;
  }
}

.sensor-shell {
  display: grid;
  gap: 14px;
}
.sensor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, #fff1db, transparent 42%),
    radial-gradient(circle at bottom right, #dbeafe, transparent 38%),
    linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.sensor-kicker {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 800;
  color: #0ea5e9;
}
.sensor-title {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}
.sensor-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.sensor-stat-chip,
.sensor-mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #334155;
}
.sensor-stat-chip.warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}
.sensor-mini-chip {
  font-size: 11px;
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.sensor-mini-chip.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #15803d;
}
.sensor-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.sensor-panel {
  border-radius: 18px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}
.sensor-side-col {
  display: grid;
  gap: 16px;
}
.sensor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  flex-wrap: wrap;
}
.sensor-subtle {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}
.sensor-empty,
.sensor-grid-empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}
.sensor-live-result {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 14px;
  margin-top: 12px;
}
.sensor-live-copy {
  padding: 4px 0;
}
.sensor-live-photo,
.sensor-photo-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #dbe4ee;
  background: #f8fafc;
}
.sensor-live-name {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}
.sensor-live-time,
.sensor-live-meta,
.sensor-counter {
  font-size: 12px;
  color: #64748b;
}
.sensor-pill {
  margin-top: 8px;
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.sensor-confirm-panel,
.sensor-label-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf4, #ffffff);
}
.sensor-panel-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}
.sensor-history {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}
.sensor-filter-bar {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sensor-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  cursor: pointer;
}
.sensor-filter-chip span {
  color: #64748b;
}
.sensor-filter-chip.active {
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
  border-color: transparent;
  color: #fff;
}
.sensor-filter-chip.active span {
  color: rgba(255,255,255,.88);
}
.sensor-pending-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}
.sensor-history-item,
.sensor-identity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}
.sensor-history-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #dbe4ee;
  background: #eef2f7;
  object-fit: cover;
  flex-shrink: 0;
}
.sensor-identity-list,
.sensor-photo-grid {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}
.sensor-pending-card {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}
.sensor-pending-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.sensor-photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}
.sensor-modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  max-width: 760px;
  width: min(92vw, 760px);
  max-height: 80vh;
  overflow: auto;
}
.sensor-pending-verify {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}
.sensor-motion-board { margin-top: 12px; }
.sensor-motion-axis-wrap {
  padding: 16px 14px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.sensor-motion-axis {
  position: relative;
  height: 24px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      to right,
      rgba(148, 163, 184, 0.14) 0,
      rgba(148, 163, 184, 0.14) calc(100% / 24 - 1px),
      rgba(255, 255, 255, 0.5) calc(100% / 24 - 1px),
      rgba(255, 255, 255, 0.5) calc(100% / 24)
    ),
    #e5eefb;
  overflow: hidden;
}
.sensor-motion-segment {
  position: absolute;
  top: 3px;
  height: 18px;
  min-width: 4px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.9;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.sensor-motion-segment.ok { background: linear-gradient(90deg, #22c55e, #16a34a); }
.sensor-motion-segment.warn { background: linear-gradient(90deg, #f59e0b, #ea580c); }
.sensor-motion-segment.soft { background: linear-gradient(90deg, #38bdf8, #2563eb); }
.sensor-motion-segment.muted { background: linear-gradient(90deg, #94a3b8, #64748b); }
.sensor-motion-segment.active {
  top: 1px;
  height: 22px;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12), inset 0 0 0 1px rgba(255,255,255,.28);
  opacity: 1;
}
.sensor-motion-ticks {
  position: relative;
  margin-top: 8px;
  height: 16px;
  font-size: 11px;
  color: #64748b;
}
.sensor-motion-ticks span {
  position: absolute;
  transform: translateX(-50%);
}
.sensor-motion-detail {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.sensor-motion-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  flex-wrap: wrap;
}
.sensor-motion-reason {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
}
.sensor-motion-reason.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #15803d;
}
.sensor-motion-reason.warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}
.sensor-motion-reason.soft {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.sensor-motion-reason.muted {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.sensor-motion-meta {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sensor-motion-meta span {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}
.sensor-motion-previews {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sensor-motion-preview {
  width: 108px;
  display: grid;
  gap: 6px;
}
.sensor-motion-preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #dbe4ee;
  background: #eef2f7;
}
.sensor-motion-caption {
  font-size: 11px;
  color: #64748b;
}
.sensor-action-modal {
  max-width: 460px;
}
.sensor-action-title {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}
@media (max-width: 860px) {
  .config-layout {
    grid-template-columns: 1fr;
  }
  .config-nav {
    position: static;
  }
  .config-subtabs {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .sensor-toolbar {
    padding: 14px;
  }
  .sensor-title {
    font-size: 21px;
  }
  .sensor-layout {
    grid-template-columns: 1fr;
  }
  .sensor-live-result {
    grid-template-columns: 1fr;
  }
  .sensor-live-photo {
    max-width: 280px;
  }
  .sensor-motion-axis-wrap { padding: 14px 10px 10px; }
  .sensor-motion-ticks { font-size: 10px; }
}
