:root {
  --bg-main: #0a0d14;
  --bg-sidebar: #0f131d;
  --bg-card: rgba(22, 27, 40, 0.7);
  --bg-card-hover: rgba(30, 37, 54, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-blue: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 20px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 16px 8px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* Navigation */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.counter-badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-weight: 600;
}

.alert-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  animation: pulse-alert 2s infinite;
}

@keyframes pulse-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Mini Device Card in Sidebar */
.device-card-mini {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.pulse-status.online {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.device-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.battery-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.battery-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.battery-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.battery-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.4s ease;
}

.sync-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent 40%),
              radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.05), transparent 40%),
              var(--bg-main);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 13, 20, 0.8);
  backdrop-filter: blur(16px);
}

.page-title-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-title-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

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

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* View Content & Tab Panes */
.view-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 32px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(12px);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bg-blue { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.bg-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.bg-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.bg-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 2px 0;
}

.text-amber { color: var(--accent-amber); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Overview Grid */
.overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

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

.panel-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-emerald);
}

.activity-feed {
  padding: 16px 24px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.act-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.act-details {
  flex-grow: 1;
}

.act-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.act-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.act-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Device Telemetry */
.device-telemetry {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.telemetry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 10px;
}

.telemetry-item:last-child {
  border-bottom: none;
}

.telem-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.telem-value {
  font-size: 0.9rem;
  font-weight: 600;
}

.telem-bar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  width: 90px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
}

/* Gallery Grid */
.toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  width: 320px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.gallery-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.gallery-card img, .gallery-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}

.gallery-card:hover .gallery-overlay {
  opacity: 1;
}

.overlay-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay-meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.gallery-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, transform 0.15s;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.gallery-card:hover .gallery-delete-btn {
  opacity: 1;
}

.gallery-delete-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Calls Table */
.calls-filter-bar {
  margin-bottom: 20px;
}

.filter-pills {
  display: flex;
  gap: 8px;
}

.pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.table-panel {
  padding: 0;
}

.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 14px 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.call-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.call-missed { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.call-incoming { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.call-outgoing { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }

/* SMS Workspace */
.sms-workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 220px);
  min-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sms-conversations-list {
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.conv-items {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
  scrollbar-width: thin;
}

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

.conv-items {
  flex-grow: 1;
  overflow-y: auto;
}

.conv-item {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.2s;
}

.conv-item:hover, .conv-item.active {
  background: rgba(99, 102, 241, 0.08);
}

.conv-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.conv-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.conv-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.conv-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sms-chat-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-contact-info h4 {
  font-size: 1.05rem;
  font-weight: 600;
}

.chat-contact-info span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}

.chat-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}

.chat-bubble.incoming {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}

.chat-bubble.outgoing {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.bubble-time {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
  text-align: right;
}

.chat-input-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
}

.chat-input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.chat-input:focus {
  border-color: var(--border-focus);
}

/* Pairing View */
.pairing-container {
  max-width: 780px;
  margin: 0 auto;
}

.pairing-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 0;
}

.step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.step-detail h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-detail p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pairing-key-box {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.secret-token {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent-blue);
  letter-spacing: 1px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
  overflow: hidden;
}

.modal-body img, .modal-body video {
  max-width: 100%;
  max-height: 65vh;
  border-radius: var(--radius-md);
  object-fit: contain;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: rgba(22, 27, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideInRight 0.3s ease;
  backdrop-filter: blur(12px);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-missed-call {
  border-left: 4px solid var(--accent-red);
}

.toast-sms {
  border-left: 4px solid var(--accent-purple);
}

.toast-photo {
  border-left: 4px solid var(--accent-blue);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  gap: 8px;
  width: 100%;
}

/* Lock Screen */
.lock-screen-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(20px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lock-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.lock-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.lock-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.lock-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.lock-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.lock-input {
  width: 100%;
  text-align: center;
  letter-spacing: 1px;
  padding: 12px 16px;
}

.lock-error {
  color: var(--accent-red);
  font-size: 0.8rem;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Connect Android Modal Styles */
.connect-android-content {
  max-width: 580px;
  background: #111528;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.15);
}

.connect-modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connect-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(85vh - 140px);
  overflow-y: auto;
}

.connect-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.connect-box-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.connect-box-info {
  flex: 1;
}

.connect-box-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.connect-box-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-download-apk {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-download-apk:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
}

.connect-creds-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cred-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cred-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cred-input-wrap {
  display: flex;
  gap: 8px;
}

.cred-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #e2e8f0;
  font-size: 0.88rem;
  outline: none;
}

.cred-input.token-font {
  font-family: var(--font-mono);
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.setup-guide-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.setup-guide-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.setup-steps-list {
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.45;
}

.setup-steps-list strong {
  color: #e2e8f0;
}

.setup-steps-list em {
  font-style: normal;
  color: #818cf8;
}

.connect-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* --- Mobile Drawer & Toggle Button --- */
.mobile-toggle-btn {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* --- Battery Charging Animations --- */
@keyframes chargingPulse {
  0% { transform: scale(1); opacity: 0.85; filter: drop-shadow(0 0 2px #10b981); }
  50% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 8px #10b981); }
  100% { transform: scale(1); opacity: 0.85; filter: drop-shadow(0 0 2px #10b981); }
}

@keyframes batteryChargeSlide {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.charging-pulse {
  display: inline-block;
  color: #10b981 !important;
  font-weight: 700;
  animation: chargingPulse 1.4s ease-in-out infinite;
}

.battery-fill.charging {
  background: linear-gradient(90deg, #10b981, #6ee7b7, #10b981) !important;
  background-size: 200% 100% !important;
  animation: batteryChargeSlide 1.5s linear infinite !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* --- Lightbox Navigation Controls --- */
.lightbox-body-container {
  position: relative;
  width: 100%;
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 19, 29, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.lightbox-nav-btn:hover {
  background: rgba(99, 102, 241, 0.9);
  border-color: rgba(99, 102, 241, 1);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-btn.prev-btn {
  left: 16px;
}

.lightbox-nav-btn.next-btn {
  right: 16px;
}

/* --- Mobile Responsive Layout Media Queries --- */
@media (max-width: 900px) {
  .mobile-toggle-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .app-layout {
    flex-direction: column;
  }

  .main-content {
    width: 100%;
  }

  .topbar {
    padding: 12px 16px;
  }

  .page-title-box h2 {
    font-size: 1.15rem;
  }

  .page-title-box p {
    font-size: 0.75rem;
  }

  .topbar-actions {
    gap: 6px;
  }

  .calls-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .calls-filter-bar > div:last-child {
    justify-content: stretch;
  }

  .calls-filter-bar #calls-search-input {
    max-width: 100% !important;
    flex: 1;
  }

  .lightbox-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .lightbox-nav-btn.prev-btn {
    left: 8px;
  }

  .lightbox-nav-btn.next-btn {
    right: 8px;
  }

  /* Responsive Overview & Panels for Mobile */
  .overview-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stat-card {
    padding: 14px 16px !important;
  }

  .device-telemetry {
    padding: 14px 16px !important;
  }

  .telemetry-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px 12px !important;
    word-break: break-word !important;
  }

  .telem-label {
    min-width: 110px !important;
    flex: 1 1 auto !important;
  }

  .telem-value {
    text-align: right !important;
    max-width: 60% !important;
    word-break: break-word !important;
  }

  /* Universal Toolbar & Input Adaptations */
  .toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .toolbar-title-box {
    margin-bottom: 4px !important;
  }

  .toolbar-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .toolbar-actions > button,
  .toolbar-actions > a,
  .toolbar-actions > label {
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  .search-input {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Gallery Grid on Mobile */
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 10px !important;
  }

  .gallery-card {
    border-radius: 10px !important;
  }

  .gallery-delete-btn {
    opacity: 0.9 !important; /* Visible on touch devices without needing hover */
    width: 28px !important;
    height: 28px !important;
  }

  /* Calls Tab & Filters */
  .calls-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .filter-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .filter-pills .pill {
    flex: 1 1 auto !important;
    text-align: center !important;
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
  }

  /* Carrier Call & SMS Forwarding Control Panels */
  #tab-calls .panel-card > div,
  #tab-sms .panel-card > div,
  #tab-devices .panel-card > div {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .cred-input,
  #input-call-fwd-number,
  #input-sms-fwd-number,
  #call-fwd-sim-select,
  #sms-reply-sim-select {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* SMS Workspace on Mobile */
  .sms-workspace {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 540px !important;
  }

  .sms-conversations-list {
    max-height: 280px !important;
    border-right: none !important;
    border-bottom: 2px solid var(--border-color) !important;
  }

  .chat-messages {
    min-height: 250px !important;
    max-height: 380px !important;
    padding: 14px !important;
  }

  .chat-bubble {
    max-width: 90% !important;
  }

  .chat-input-bar {
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .chat-input-bar select {
    width: 100% !important;
  }

  .chat-input-bar input {
    flex: 1 1 180px !important;
  }

  /* Devices & Pairing */
  .devices-table {
    min-width: 580px !important;
  }

  .table-responsive, .table-container {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-md) !important;
  }

  /* Live Screen Mirror on Mobile Phones */
  .screen-mirror-wrapper {
    padding: 0 0 20px !important;
  }

  .phone-frame-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 10px 8px 14px 8px !important;
    border-radius: 28px !important;
  }

  /* Modal Dialogs on Mobile Devices */
  .modal-content,
  .lock-card,
  .connect-android-content,
  .device-info-modal-content {
    max-width: 96vw !important;
    width: 96vw !important;
    padding: 16px !important;
    margin: 10px auto !important;
    box-sizing: border-box !important;
  }

  .connect-creds-container .cred-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .connect-creds-container .cred-input-wrap {
    width: 100% !important;
  }

  /* Active device banner */
  .active-device-context {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    margin: 8px 12px !important;
    padding: 10px 12px !important;
  }

  .active-device-context .active-device-scope {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 10px 12px !important;
  }

  .topbar-actions {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .topbar-actions .btn {
    padding: 6px 9px !important;
    font-size: 0.76rem !important;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}

/* --- Live Screen Mirroring Styles --- */
.screen-mirror-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 30px;
  width: 100%;
}

.phone-frame-container {
  width: 360px;
  max-width: 92vw;
  background: #0f131d;
  border-radius: 44px;
  padding: 16px 12px 18px 12px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}

.phone-frame-container.live-active {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 45px rgba(239, 68, 68, 0.35);
}

.phone-frame-speaker {
  width: 48px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin-bottom: 10px;
}

.phone-screen-area {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 32px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#screen-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.screen-standby-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 19, 29, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.screen-pulse-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  border: 2px solid rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  animation: chargingPulse 2s infinite ease-in-out;
}

.screen-hud-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  color: #f8fafc;
  z-index: 6;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Fullscreen Mode for Phone Screen Mirror */
.phone-frame-container:fullscreen {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 0 !important;
  background: #000 !important;
}

.phone-frame-container:fullscreen .phone-screen-area {
  border-radius: 0 !important;
  height: 100vh !important;
  width: 100vw !important;
}

.phone-frame-container:fullscreen .phone-frame-speaker {
  display: none !important;
}

/* Device Fleet Table Styles */
.devices-table th {
  white-space: nowrap;
}

.device-cell-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-icon-bubble {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06b6d4;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.device-icon-bubble.online {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.device-info-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.device-name-text {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
}

.device-model-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.device-id-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
  width: fit-content;
}

.battery-table-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.battery-percent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.battery-track-table {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.battery-fill-table {
  height: 100%;
  border-radius: 4px;
  background: #10b981;
  transition: width 0.4s ease;
}

.battery-fill-table.warning {
  background: #f59e0b;
}

.battery-fill-table.critical {
  background: #ef4444;
}

.badge-online {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-offline {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

.actions-cell-wrap {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

/* Device fleet / connection state UX */
.sync-state-line {padding:10px 16px;font-size:.84rem;color:var(--text-secondary);border-bottom:1px solid var(--border-color);}
.sync-state-line[data-state="error"] {color:#fca5a5;}
.sync-state-line[data-state="success"] {color:#86efac;}
.sync-muted {color:var(--text-muted);font-size:.86rem;}
.devices-table {width:100%;}
.devices-table td,.devices-table th {vertical-align:middle;}
.devices-table td:first-child,.devices-table th:first-child {width:76px;text-align:center;}
.devices-table .device-icon-bubble {margin:auto;}
.devices-table .device-name-text {display:block;max-width:230px;overflow-wrap:anywhere;}
.devices-table .actions-cell-wrap {justify-content:flex-end;flex-wrap:wrap;}
#sms-load-status {border-bottom:0;padding:10px 13px;}
#screen-state-detail {margin:0 0 14px;border:1px solid var(--border-color);border-radius:9px;}
@media (max-width:650px) {
  .devices-table td,.devices-table th{padding:10px 8px;font-size:.79rem;}
  .devices-table td:first-child,.devices-table th:first-child{width:45px;}
  .devices-table .device-icon-bubble{transform:scale(.9);}
  .devices-table .actions-cell-wrap{gap:5px;}
  .devices-table .actions-cell-wrap .btn{padding:5px 7px;}
}

/* Compact optional settings keep the inbox above the fold */
.sms-settings-details {padding:0 !important;margin-bottom:12px !important;}
.sms-settings-details > summary {padding:12px 18px;cursor:pointer;color:var(--text-secondary);font-size:.88rem;font-weight:600;}
.sms-settings-details .sms-settings-content {padding:8px 18px 16px;}
#tab-sms .sms-workspace {height: min(740px,calc(100vh - 210px));min-height:360px;}
#tab-sms .conv-item {font-family:inherit;color:var(--text-primary);background:transparent;}
#tab-sms .conv-item:hover,#tab-sms .conv-item.active {background:rgba(99,102,241,.10);}
@media(max-width:750px) {#tab-sms .sms-workspace{height:auto;min-height:500px;}}

/* Browser-notification permission and live status, with content-free event log. */
.web-alert-actions {display:flex;flex-wrap:wrap;gap:8px;}
.web-notification-status {display:flex;flex-wrap:wrap;gap:9px;margin-bottom:10px;}
.web-notification-status span {background:var(--card-dark, #131b2a);border:1px solid var(--border-color,#293345);border-radius:8px;padding:9px 12px;font-size:.8rem;}
.web-alert-log-header {display:flex;justify-content:space-between;align-items:center;gap:12px;margin:15px 0 7px;}
.web-alert-history {list-style:none;padding:0;margin:0;max-height:170px;overflow-y:auto;}
.web-alert-history li {display:flex;justify-content:space-between;gap:10px;padding:7px 0;border-bottom:1px solid rgba(255,255,255,.06);font-size:.82rem;}
.web-alert-history time {color:var(--text-muted);font-size:.75rem;white-space:nowrap;}
.web-alert-history .web-alert-empty {color:var(--text-muted);}
@media(max-width:720px){.web-alert-actions{width:100%;}.web-alert-actions button{flex:1;}}

/* Read-only camera capability/status panel (no remote start or recording controls). */
.camera-selected-device {display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:16px;}
.camera-selected-device code {font-size:.77rem;color:var(--text-muted);overflow-wrap:anywhere;}
.camera-status-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.camera-status-grid>div {border:1px solid var(--border-color);padding:12px;border-radius:10px;display:flex;flex-direction:column;gap:6px;min-width:0;}
.camera-status-grid>div span {font-size:.76rem;color:var(--text-muted);}
.camera-status-grid>div strong {font-size:.9rem;color:var(--text-primary);overflow-wrap:anywhere;}
@media(max-width:760px) {.camera-status-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

/* Consistent test device identity, not a credential. */
.sidebar-device-id {font-size:.72rem;color:var(--text-muted);margin:0 0 10px 0;overflow-wrap:anywhere;}
.sidebar-device-id code {color:var(--text-secondary);font-family:monospace;}
.active-device-context {display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:12px 22px;padding:10px 14px;border:1px solid var(--border-color);border-radius:10px;background:var(--bg-card);font-size:.79rem;}
.active-device-context-title {display:flex;align-items:center;gap:6px;color:var(--text-secondary);}
.context-dot {display:inline-block;width:7px;height:7px;border-radius:50%;background:#64748b;}
.active-device-context strong {color:var(--text-primary);}
.active-device-context code {font-size:.76rem;padding:5px 9px;border-radius:6px;background:rgba(148,163,184,.12);color:var(--text-primary);overflow-wrap:anywhere;}
.active-device-context .active-device-scope {color:var(--text-muted);margin-left:auto;max-width:400px;}
.owner-permissions-header{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;}
.owner-permissions-body{padding:12px 18px 18px;}
.owner-permissions-body>.sync-state-line{padding:10px 0;margin-bottom:12px;border-bottom:0;}
.owner-permissions-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.owner-permission-item{display:flex;flex-direction:column;gap:6px;min-width:0;padding:14px;border:1px solid var(--border-color);border-radius:10px;background:rgba(148,163,184,.05);}
.owner-permission-item strong{font-size:.92rem;color:var(--text-primary);}
.owner-permission-item span{font-size:.82rem;color:var(--text-secondary);}
.owner-permission-item small{font-size:.76rem;line-height:1.5;color:var(--text-muted);}
.owner-permissions-details{margin-top:12px;padding:12px;border:1px solid var(--border-color);border-radius:10px;color:var(--text-secondary);font-size:.82rem;line-height:1.6;}
.owner-permissions-details summary{cursor:pointer;font-weight:650;color:var(--accent-blue);}
.owner-permissions-details p{margin-top:8px;}
.gallery-toolbar-status{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;flex-wrap:wrap;}
.gallery-toolbar-status .sync-state-line{border:0;padding:0;}
@media(max-width:720px){.owner-permissions-grid{grid-template-columns:1fr;}.gallery-toolbar-status{align-items:flex-start;}}
.multi-device-note {font-size:.79rem;line-height:1.5;color:var(--text-secondary);background:rgba(148,163,184,.09);border:1px solid var(--border-color);border-radius:9px;padding:10px 13px;margin:8px 0 14px;}
.devices-table .device-id-code {display:block;max-width:260px;word-break:break-all;font-family:monospace;}
.device-info-modal-content {max-width:590px;width:calc(100% - 22px);}
.device-info-modal-content .modal-header h3 {margin:0 0 4px;font-size:1.15rem;}
.device-info-grid {padding:18px;display:grid;grid-template-columns:1fr 1fr;gap:14px;}
.device-info-grid > div {display:flex;flex-direction:column;gap:5px;min-width:0;}
.device-info-grid small {color:var(--text-muted);}
.device-info-grid strong,.device-info-grid code {font-size:.83rem;overflow-wrap:anywhere;color:var(--text-primary);}
.device-info-modal-content .multi-device-note {margin:0 18px 16px;}
.device-info-actions {display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:0 18px 18px;}
@media(max-width:760px){.active-device-context{margin:8px 12px;}.active-device-context .active-device-scope{margin-left:0;max-width:100%;}.device-info-grid{grid-template-columns:1fr;}}

/* BlackBox original arcade theme: playful game energy, readable control UI.
   No character art, names, or assets from third-party games. */
:root {
  --bg-main: #101b30;
  --bg-sidebar: #14243b;
  --bg-card: rgba(28,44,67,.90);
  --bg-card-hover: rgba(39,60,86,.96);
  --border-color: rgba(132,185,219,.22);
  --border-focus: rgba(255,210,103,.75);
  --text-primary: #fff9f1;
  --text-secondary: #c8d8e8;
  --text-muted: #97aec1;
  --accent-primary: #ff8661;
  --accent-primary-hover: #ff7555;
  --accent-blue: #5bd9f4;
  --accent-emerald: #78dea1;
  --accent-amber: #ffd267;
  --accent-red: #f17876;
  --accent-purple: #cba7ff;
  --radius-md: 14px;
  --radius-lg: 20px;
}
body { background: #101b30; }
.main-content {
  background:
    radial-gradient(circle at 88% 2%,rgba(255,210,103,.095),transparent 33%),
    radial-gradient(circle at 4% 90%,rgba(91,217,244,.09),transparent 40%),
    linear-gradient(155deg,#172a45 0%,#101b30 70%);
}
.sidebar {background:linear-gradient(180deg,#1c3554 0%,#14253d 42%,#111d32 100%);border-right:1px solid rgba(91,217,244,.17);}
.brand-icon {background:linear-gradient(145deg,#ffd267 0%,#ff8866 62%,#f36545 100%);color:#17233a;border:2px solid rgba(255,249,241,.35);box-shadow:0 5px 0 rgba(10,18,35,.5),0 9px 22px rgba(243,101,69,.18);border-radius:16px;}
.brand-text h1 {font-weight:800;letter-spacing:.02em;color:#fff9f1;}
.brand-badge {background:rgba(255,210,103,.15);color:#ffdf91;border:1px solid rgba(255,210,103,.25);font-weight:700;letter-spacing:.04em;}
.topbar {background:rgba(21,36,58,.94);border-bottom:2px solid rgba(255,210,103,.14);}
.page-title-box h2 {font-weight:800;letter-spacing:.008em;}
.nav-item {border-radius:14px;font-weight:650;}
.nav-item:hover {background:rgba(255,210,103,.07);border-color:rgba(255,210,103,.13);}
.nav-item.active {color:#ffdf92;background:linear-gradient(100deg,rgba(255,139,99,.2),rgba(255,210,103,.06));border:1px solid rgba(255,188,112,.46);box-shadow:inset 3px 0 #ff8866;}
.nav-item.active svg {color:#ffad73;}
.btn-primary {background:linear-gradient(135deg,#ffd267,#ff8866);color:#182639;border-color:rgba(255,216,137,.5);box-shadow:0 3px 0 #b6583e,0 8px 20px rgba(241,120,84,.13);font-weight:800;}
.btn-primary:hover {background:linear-gradient(135deg,#ffdf8f,#ff9b77);color:#142439;box-shadow:0 2px 0 #b6583e,0 6px 18px rgba(241,120,84,.2);}
.btn-primary:active {transform:translateY(2px);box-shadow:0 1px 0 #b6583e;}
.btn-secondary {background:rgba(255,255,255,.065);border-color:rgba(132,185,219,.27);}
.btn-secondary:hover {background:rgba(255,210,103,.10);border-color:rgba(255,210,103,.40);}
.btn:focus-visible,.nav-item:focus-visible,.device-selector:focus-visible {outline:3px solid #ffd267;outline-offset:3px;}
.panel-card {border:1px solid rgba(91,217,244,.18);box-shadow:0 12px 28px rgba(3,10,25,.14);}
.panel-header {border-bottom-color:rgba(132,185,219,.18);}
.stat-card {border-color:rgba(255,210,103,.19);box-shadow:0 9px 24px rgba(3,10,25,.15);}
.stat-card:nth-child(4n+1) {border-top:3px solid #ffd267;}
.stat-card:nth-child(4n+2) {border-top:3px solid #ff8866;}
.stat-card:nth-child(4n+3) {border-top:3px solid #5bd9f4;}
.stat-card:nth-child(4n+4) {border-top:3px solid #78dea1;}
.device-card-mini {background:rgba(12,26,44,.6);border:1px solid rgba(91,217,244,.28);box-shadow:inset 0 1px rgba(255,255,255,.04);}
.active-device-context {border-color:rgba(255,210,103,.29);background:rgba(34,49,69,.95);border-radius:14px;}
.owner-permissions {border-color:rgba(255,210,103,.34);}
.owner-permission-item:nth-child(4n+1) {border-left:3px solid #ffd267;}
.owner-permission-item:nth-child(4n+2) {border-left:3px solid #5bd9f4;}
.owner-permission-item:nth-child(4n+3) {border-left:3px solid #ff8866;}
.owner-permission-item:nth-child(4n+4) {border-left:3px solid #78dea1;}
@media (max-width:1050px) {.topbar-actions {flex-wrap:wrap;justify-content:flex-end;gap:8px;}}
@media (max-width:720px) {.topbar{padding:12px 14px;}.brand-icon{box-shadow:0 3px 0 rgba(10,18,35,.5);}.view-content{padding:14px;}}
@media (prefers-reduced-motion:reduce) {.btn-primary,.nav-item{transition:none;}.btn-primary:hover{transform:none;}}
