/* ============================================================
   Cloudfy / Family Guard — Modern SaaS Light Theme (AirDroid Style)
   ============================================================ */

:root {
  /* Color Palette — Clean SaaS Light Theme */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-hover: #e2e8f0;

  --border-light: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #0284c7;

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #0284c7;          /* Sky 600 - AirDroid Signature Blue */
  --primary-hover: #0369a1;    /* Sky 700 */
  --primary-subtle: #f0f9ff;   /* Sky 50 */
  --primary-border: #bae6fd;   /* Sky 200 */

  --success: #059669;          /* Emerald 600 */
  --success-subtle: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #d97706;          /* Amber 600 */
  --warning-subtle: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;           /* Red 600 */
  --danger-subtle: #fef2f2;
  --danger-border: #fecaca;

  --indigo: #4f46e5;
  --indigo-subtle: #eef2ff;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-dropdown: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 270px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-body);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Master SaaS Layout */
.saas-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ============================================================
   1. Left Sidebar Navigation (AirDroid Style)
   ============================================================ */
.saas-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(15, 23, 42, 0.02);
}

.sidebar-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  line-height: 1.2;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: var(--primary-subtle);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Connected Device Selector Card */
.sidebar-device-box {
  padding: 16px 18px;
  margin: 14px 16px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.device-meta .device-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

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

.device-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-light);
}

.device-status-badge.connected {
  background: var(--success-subtle);
  border-color: var(--success-border);
  color: var(--success);
}

.device-status-badge.standby {
  background: var(--warning-subtle);
  border-color: var(--warning-border);
  color: var(--warning);
}

.device-status-badge.disconnected {
  background: var(--bg-surface-subtle);
  border-color: var(--border-light);
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-light);
  flex-shrink: 0;
}

.status-dot.connected {
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
  animation: pulse-green 2s infinite;
}

.status-dot.standby {
  background-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.status-dot.disconnected {
  background-color: #cbd5e1;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

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

.mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* Navigation Links */
.sidebar-nav {
  padding: 6px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 10px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--text-body);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.nav-item i {
  font-size: 1rem;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-surface-subtle);
  color: var(--primary);
}

.nav-item:hover i {
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.nav-item.active i {
  color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-apk-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-body);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition);
}

.sidebar-apk-btn:hover {
  background: var(--primary-subtle);
  border-color: var(--primary-border);
  color: var(--primary);
}

.sidebar-meta-text {
  font-size: 0.72rem;
  color: var(--text-light);
  text-align: center;
}

/* ============================================================
   2. Main Content Canvas & Tabbed Views
   ============================================================ */
.saas-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top App Header / Navbar with Global Device Selector (Matches Image 2) */
.saas-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  min-height: 65px;
}

/* Navbar Device Selector & Dropdown (Matches Image 2) */
.nav-device-selector {
  position: relative;
}

.nav-device-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.nav-device-trigger:hover {
  background: var(--bg-surface-subtle);
}

.nav-device-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-device-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-device-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-device-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.nav-device-chevron {
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.nav-device-selector.open .nav-device-chevron {
  transform: rotate(180deg);
}

.nav-device-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.device-pill.battery {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #d1fae5;
}

.device-pill.wifi {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Dropdown Menu (Matches Image 2) */
.nav-device-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 250px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 12px 30px -5px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border-light);
  z-index: 1100;
  overflow: hidden;
  animation: dropdown-fade 0.2s ease-out;
}

.nav-device-dropdown.active {
  display: block !important;
}

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

.dropdown-device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-device-item:hover {
  background: var(--bg-surface-subtle);
}

.dropdown-device-item.active {
  background: #f0f7ff;
}

.dd-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dd-avatar {
  flex-shrink: 0;
}

.dd-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dd-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-heading);
}

.dd-pills {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dd-check {
  color: #2563eb;
  font-size: 1rem;
  font-weight: 800;
}

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

.dropdown-add-device {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-heading);
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-add-device:hover {
  background: var(--bg-surface-subtle);
  color: var(--primary);
}

.dropdown-add-device i {
  color: var(--text-muted);
}

.nav-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

.nav-status-pill.online {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

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

/* Primary and Secondary Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn i {
  font-size: 0.95rem;
}

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

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-body);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-subtle);
  border-color: #cbd5e1;
  color: var(--text-heading);
}

.btn-outline-primary {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-wake {
  background: linear-gradient(135deg, #d97706, #ea580c);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}

.btn-wake:hover:not(:disabled) {
  background: linear-gradient(135deg, #b45309, #c2410c);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-heading);
}

/* High Priority Geofence Alert Banner */
.geofence-alert-banner {
  margin: 20px 32px 0;
  background: #ffffff;
  border: 1px solid var(--danger-border);
  border-left: 5px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-card);
  animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.alert-icon-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--danger-subtle);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.alert-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-title-row h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--danger);
}

.alert-badge-status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #ffffff;
}

.alert-badge-status.enter {
  background: var(--success);
}

.alert-text-body p {
  font-size: 0.8rem;
  color: var(--text-body);
  margin-top: 2px;
}

.btn-alarm-dismiss {
  background: var(--danger-subtle);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Page Body Container & Tab Switching */
.saas-content {
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.saas-view {
  display: none;
  animation: view-fade-in 0.25s ease-out;
}

.saas-view.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@keyframes view-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   3. Quick KPI / Metrics Ribbon (AirDroid Style)
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.kpi-icon-box {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.kpi-icon-box.sky { background: var(--primary-subtle); color: var(--primary); }
.kpi-icon-box.emerald { background: var(--success-subtle); color: var(--success); }
.kpi-icon-box.amber { background: var(--warning-subtle); color: var(--warning); }
.kpi-icon-box.indigo { background: var(--indigo-subtle); color: var(--indigo); }

.kpi-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-value-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kpi-bolt-icon {
  color: #f59e0b;
  font-size: 0.95rem;
  animation: pulse-bolt 1.5s ease-in-out infinite;
}

@keyframes pulse-bolt {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-light);
}

/* ============================================================
   4. Card Generic Shell
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.card:hover {
  border-color: #cbd5e1;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i {
  font-size: 1.05rem;
}

.card-title h2 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

/* ============================================================
   5. Battery Usage History Interactive Chart
   ============================================================ */
.chart-card {
  width: 100%;
}

.chart-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.filter-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.filter-btn i { font-size: 0.8rem; }
.filter-btn:hover { color: var(--text-heading); }

.filter-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.custom-range-bar {
  padding: 12px 20px;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  animation: slide-down 0.2s ease-out;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.range-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
}

.input-field-sm {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.78rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-heading);
  outline: none;
}

.input-field-sm:focus {
  border-color: var(--primary);
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 310px;
  padding: 16px 20px;
}

.chart-footer-meta {
  padding: 10px 20px;
  background: var(--bg-surface-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.bg-emerald { background-color: var(--success); }
.bg-amber { background-color: var(--warning); }

/* ============================================================
   6. Overview 3 Widgets Grid
   ============================================================ */
.overview-widgets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.widget-card {
  display: flex;
  flex-direction: column;
}

.widget-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.health-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.health-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.health-icon.sky { background: var(--primary-subtle); color: var(--primary); }
.health-icon.amber { background: var(--warning-subtle); color: var(--warning); }
.health-icon.emerald { background: var(--success-subtle); color: var(--success); }
.health-icon.indigo { background: var(--indigo-subtle); color: var(--indigo); }

.health-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.health-label {
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 600;
}

.health-val {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-heading);
}

.badge-status-online {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--success-subtle);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.widget-link-btn {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.widget-link-btn:hover {
  text-decoration: underline;
}

.location-snapshot-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
}

.loc-pin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.loc-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.loc-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-heading);
}

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

.loc-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  margin-top: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;
}

.loc-tag:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.loc-tag.safe {
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.loc-tag.outside {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}

.loc-tag.neutral {
  color: #64748b;
  background: rgba(100, 116, 139, 0.08);
  border-color: rgba(100, 116, 139, 0.2);
}

.quick-distance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.quick-dist-label {
  color: var(--text-muted);
}

.quick-dist-val {
  font-weight: 800;
  color: var(--primary);
}

.top-apps-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.top-app-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-app-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.top-app-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-heading);
}

.top-app-time {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Security Alerts Feed Widget & Badges */
.overview-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overview-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
}

.overview-alert-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview-alert-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.overview-alert-pill.exit {
  background: #fee2e2;
  color: #dc2626;
}

.overview-alert-pill.enter {
  background: #ecfdf5;
  color: #059669;
}

.overview-alert-name {
  font-weight: 700;
  color: var(--text-heading);
}

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

.badge-status-security {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ============================================================
   7. Remote Camera Stream Card (WebRTC Tight Output Fit)
   ============================================================ */
.camera-card {
  width: 100%;
}

.camera-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.camera-mode-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.mode-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.mode-btn i { font-size: 0.75rem; }
.mode-btn:hover { color: var(--text-heading); }
.mode-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Camera Stage & Viewport (Tightly Wrapped around True Output Video - Zero Black Pillars) */
.camera-stage {
  width: 100%;
  background: #f8fafc;
  background-image: radial-gradient(#cbd5e1 1.2px, transparent 1.2px);
  background-size: 20px 20px;
  padding: 36px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  min-height: 520px;
  position: relative;
  border: 1px solid var(--border-light);
}

/* ============================================================
   Camera Monitoring Studio (2-Column Grid Layout)
   ============================================================ */
.camera-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1.15fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .camera-studio-grid {
    grid-template-columns: 1fr;
  }
}

.camera-studio-main {
  display: flex;
  flex-direction: column;
}

.camera-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.08);
  border: 5px solid #0f172a;
  background: #000000;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 320px;
  height: 520px;
  max-width: 100%;
}

#remoteVideo {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: 19px;
  object-fit: cover;
}

#remoteVideo.fit-cover {
  object-fit: cover;
}

#remoteVideo.mirrored {
  transform: scaleX(-1);
}

/* In-Feed Floating HUD Badges */
.cam-hud-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 15;
  pointer-events: none;
}

.hud-group-left,
.hud-group-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hud-pill.hud-live {
  background: rgba(220, 38, 38, 0.85);
  border-color: rgba(254, 202, 202, 0.3);
}

.hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
  animation: pulse-dot 1.2s infinite;
}

.hud-pill.hud-timer {
  font-family: monospace;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.hud-pill.hud-facing {
  background: rgba(15, 23, 42, 0.85);
}

.hud-pill.hud-mirror {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Camera Shutter Flash Animation */
.camera-shutter-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease-out;
}

.camera-shutter-flash.flashing {
  opacity: 0.9;
  transition: none;
}

.cam-badge {
  display: none !important;
}

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 30px;
  gap: 14px;
  color: #94a3b8;
  min-width: 320px;
}

.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 1.5rem;
}

.placeholder-text {
  font-size: 0.85rem;
  color: #94a3b8;
  max-width: 280px;
}

/* Floating Controls inside Stream Dock */
.stream-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.stream-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
}

.stream-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

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

.stream-btn.mic-active {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.65);
}

.stream-btn.flash-on {
  background: #f59e0b;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.65);
}

.stream-btn.danger {
  background: var(--danger);
  color: #ffffff;
}

.stream-btn.danger:hover {
  background: #b91c1c;
}

.camera-footer {
  padding: 12px 20px;
  background: var(--bg-surface-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.info-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.latency-tag {
  font-weight: 700;
  color: var(--primary);
}

/* ============================================================
   Studio Sidebar Cards: Diagnostics & Snapshots
   ============================================================ */
.camera-studio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.studio-panel-card {
  padding: 0;
  overflow: hidden;
}

.studio-panel-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.studio-metrics-list {
  padding: 8px 20px 16px;
  display: flex;
  flex-direction: column;
}

.studio-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.studio-metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-label i {
  width: 16px;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
}

.metric-val {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 0.82rem;
}

.status-chip {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-chip.off {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.status-chip.on {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.status-chip.amber {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

/* Snapshots Gallery */
.studio-snapshots-panel {
  padding: 16px 20px 20px;
  min-height: 180px;
}

.snapshots-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.snapshots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.snapshot-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: #0f172a;
  aspect-ratio: 4/3;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.snapshot-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.snapshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.snapshot-item .snap-time {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 0.65rem;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.snapshot-item .snap-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.snapshot-item .snap-btn-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  text-decoration: none;
  transition: background 0.2s;
}

.snapshot-item .snap-btn-icon:hover {
  background: var(--primary);
}

/* ============================================================
   8. GPS Location Full-Bleed Map View (Matches User Images)
   ============================================================ */
.saas-view.view-map-fullscreen {
  padding: 0 !important;
  margin: 0 !important;
  height: calc(100vh - 65px) !important;
  position: relative !important;
  overflow: hidden !important;
  flex: 1;
}

.view-map-fullscreen .map-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.view-map-fullscreen #map {
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* 1. Buffering / Compass Loading Animation (Matches Image 1) */
.map-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f8fafc;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.map-loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.world-map-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.15;
  background-image: radial-gradient(#94a3b8 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  pointer-events: none;
}

.compass-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
  z-index: 10;
}

.compass-rose {
  border-radius: 50%;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(226, 232, 240, 0.8);
  background: #ffffff;
}

.compass-needle-group {
  transform-origin: 70px 70px;
  animation: compass-spin 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes compass-spin {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(180deg); }
  55%  { transform: rotate(330deg); }
  75%  { transform: rotate(260deg); }
  100% { transform: rotate(360deg); }
}

.compass-loading-text {
  font-size: 0.96rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: -0.01em;
}

/* 2. Floating "All Devices" Window Card (Matches Image 3) */
.map-floating-panel {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 350px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.04);
  z-index: 1000;
  overflow: hidden;
  animation: panel-drop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panel-drop {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-heading);
}

.panel-refresh-btn {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
}

.panel-refresh-btn:hover {
  color: var(--primary);
  background: var(--bg-surface-subtle);
  transform: rotate(180deg);
}

.panel-device-card {
  padding: 6px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-device-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.panel-device-avatar {
  flex-shrink: 0;
  margin-top: 2px;
}

.panel-device-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.panel-device-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-device-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-heading);
}

.panel-device-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.panel-device-address {
  font-size: 0.75rem;
  color: var(--text-body);
  line-height: 1.4;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Multi-Device Floating List in Map Panel */
.map-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
  margin-bottom: 4px;
}

.map-devices-list::-webkit-scrollbar {
  width: 4px;
}

.map-devices-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.floating-device-item {
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.floating-device-item:hover {
  border-color: var(--dev-theme-color, var(--primary));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.floating-device-item.active {
  border-color: var(--dev-theme-color, var(--primary));
  background: var(--dev-theme-bg, #f8fafc);
  box-shadow: 0 4px 14px var(--dev-theme-shadow, rgba(99, 102, 241, 0.15));
}

.floating-device-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--dev-theme-color, var(--primary));
}

.fdev-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.fdev-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--dev-theme-bg, #e0e7ff);
  border: 2px solid var(--dev-theme-color, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--dev-theme-color, #6366f1);
  font-size: 0.95rem;
  box-shadow: 0 2px 8px var(--dev-theme-shadow, rgba(99, 102, 241, 0.2));
}

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

.fdev-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.fdev-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fdev-badge-group {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

.fdev-battery {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #10b981;
}

.fdev-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.fdev-status-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.fdev-status-dot.standby {
  background: #f59e0b;
}

.fdev-status-dot.offline {
  background: #94a3b8;
}

.fdev-address {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.fdev-focus-btn {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.floating-device-item:hover .fdev-focus-btn,
.fdev-focus-btn:hover {
  background: var(--dev-theme-color, var(--primary));
  border-color: var(--dev-theme-color, var(--primary));
  color: #ffffff;
}

/* Multi-Device Custom Leaflet Map Pin Markers */
.custom-device-map-marker {
  background: transparent !important;
  border: none !important;
}

.pin-device-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.device-pin-tag {
  background: #ffffff;
  border: 1.5px solid var(--theme-color, #6366f1);
  color: var(--theme-color, #6366f1);
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 99px;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.16);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.device-pin-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--theme-bg, #ffffff);
  border: 2.5px solid var(--theme-color, #6366f1);
  box-shadow: 0 4px 14px var(--theme-shadow, rgba(99, 102, 241, 0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.device-pin-pulse {
  position: absolute;
  top: 19px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--theme-pulse, rgba(99, 102, 241, 0.25));
  animation: pulse-avatar-pin 2.2s infinite ease-out;
  z-index: 1;
  pointer-events: none;
}

.custom-device-map-marker:hover .device-pin-circle,
.custom-device-map-marker.active-device .device-pin-circle {
  transform: scale(1.18);
  border-width: 3.5px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 8px 20px var(--theme-shadow, rgba(99, 102, 241, 0.45));
}

.custom-device-map-marker.active-device .device-pin-tag {
  background: var(--theme-color, #6366f1);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--theme-shadow, rgba(99, 102, 241, 0.4));
}

.custom-device-map-marker.is-offline {
  opacity: 0.82;
  filter: grayscale(25%);
}

.custom-device-map-marker.is-offline .device-pin-pulse {
  display: none !important;
}

.pin-offline-tag {
  font-size: 0.62rem;
  color: #94a3b8;
  font-weight: 600;
  margin-left: 2px;
}

.panel-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}

.panel-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-heading);
  cursor: pointer;
  transition: var(--transition);
}

.panel-action-btn:hover {
  background: var(--primary-subtle);
  border-color: var(--primary-border);
  color: var(--primary);
}

.panel-action-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.panel-action-btn.active i {
  color: #ffffff !important;
}

.badge-pro {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

.panel-layer-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  gap: 4px;
  margin-top: 4px;
}

.layer-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.layer-tab:hover {
  color: var(--text-heading);
}

.layer-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}


/* Custom Leaflet Child Pin with Berry Avatar (Matches Image 3) */
.child-avatar-map-pin {
  background: transparent;
  border: none;
}

.pin-avatar-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  border: 3px solid #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
  position: relative;
}

.pin-avatar-pulse {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.25);
  animation: pulse-avatar-pin 2s infinite ease-out;
  z-index: 1;
}

@keyframes pulse-avatar-pin {
  0% { transform: scale(0.8); opacity: 0.8; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

.map-overlay-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  z-index: 500;
}

/* ============================================================
   9. App Activity & Screen Time Today Card (Modern AirDroid SaaS Layout)
   ============================================================ */
.activity-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.activity-top-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.activity-page-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0;
  letter-spacing: -0.02em;
}

.activity-period-toggle {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.pill-toggle {
  padding: 6px 16px;
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-toggle.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.activity-date-nav {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 2px 4px;
  box-shadow: var(--shadow-sm);
}

.date-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-nav-btn:hover {
  background: #f1f5f9;
  color: var(--text-heading);
}

.date-nav-display {
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-heading);
}

.activity-top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-update-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-icon-refresh {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-icon-refresh:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: rotate(45deg);
}

/* Real-Time Live App Banner */
.current-app-live-banner {
  margin-bottom: 20px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.live-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.live-badge-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #047857;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-app-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid #d1fae5;
  font-size: 0.85rem;
  font-weight: 800;
  color: #064e3b;
}

.live-banner-time {
  font-size: 0.78rem;
  color: #059669;
  font-weight: 600;
}

/* Screen Time Card */
.screen-time-card {
  margin-bottom: 24px;
  padding: 24px;
}

.screen-time-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.screen-time-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.total-screen-time-val {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.comparison-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #059669;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.screen-time-chart-container {
  width: 100%;
  height: 240px;
  position: relative;
  margin-bottom: 24px;
}

/* Interactive Loading State for Chart */
.screen-time-chart-container.is-loading canvas {
  opacity: 0.22;
  filter: blur(1.5px);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.chart-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.chart-loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.chart-skeleton-bars {
  position: absolute;
  bottom: 25px;
  left: 20px;
  right: 20px;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  opacity: 0.75;
  pointer-events: none;
}

.skeleton-chart-bar {
  flex: 1;
  max-width: 28px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.3) 0%, rgba(245, 158, 11, 0.2) 50%, rgba(16, 185, 129, 0.3) 100%);
  animation: skeletonBarWave 1.3s ease-in-out infinite alternate;
}

.skeleton-chart-bar:nth-child(1) { animation-delay: 0s; }
.skeleton-chart-bar:nth-child(2) { animation-delay: 0.15s; }
.skeleton-chart-bar:nth-child(3) { animation-delay: 0.3s; }
.skeleton-chart-bar:nth-child(4) { animation-delay: 0.45s; }
.skeleton-chart-bar:nth-child(5) { animation-delay: 0.6s; }
.skeleton-chart-bar:nth-child(6) { animation-delay: 0.75s; }
.skeleton-chart-bar:nth-child(7) { animation-delay: 0.9s; }
.skeleton-chart-bar:nth-child(8) { animation-delay: 1.05s; }

@keyframes skeletonBarWave {
  0% { transform: scaleY(0.4); opacity: 0.35; }
  50% { transform: scaleY(1.0); opacity: 0.85; filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4)); }
  100% { transform: scaleY(0.5); opacity: 0.45; }
}

.chart-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-heading);
  animation: floatBadge 2s ease-in-out infinite;
  z-index: 2;
}

.chart-loading-badge i {
  color: var(--primary);
  font-size: 1.05rem;
}

@keyframes floatBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Category Breakdown Cards (3 Cards Matching Screenshot) */
.category-breakdown-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
}

.category-section-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .category-cards-grid {
    grid-template-columns: 1fr;
  }
}

.category-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.category-card.cat-game {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.category-card.cat-comm {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.category-card.cat-other {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

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

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cat-dot-game { background: #3b82f6; }
.cat-dot-comm { background: #f59e0b; }
.cat-dot-other { background: #10b981; }

.cat-name {
  font-size: 0.82rem;
  font-weight: 700;
}

.cat-game .cat-name { color: #1d4ed8; }
.cat-comm .cat-name { color: #b45309; }
.cat-other .cat-name { color: #047857; }

.cat-duration {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cat-game .cat-duration { color: #1e3a8a; }
.cat-comm .cat-duration { color: #78350f; }
.cat-other .cat-duration { color: #064e3b; }

/* Most Used Apps Card & Android-Style Progress Bars */
.most-used-apps-card {
  padding: 0;
  overflow: hidden;
}

.apps-count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.most-used-apps-list {
  display: flex;
  flex-direction: column;
}

.most-used-app-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.most-used-app-row:last-child {
  border-bottom: none;
}

.most-used-app-row:hover {
  background: #f8fafc;
}

.app-logo-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border-light);
}

.app-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-logo-box svg {
  width: 28px;
  height: 28px;
}

.app-details-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-name-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-cat-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.app-cat-badge.cat-game {
  background: #dbeafe;
  color: #1d4ed8;
}

.app-cat-badge.cat-communication {
  background: #fef3c7;
  color: #b45309;
}

.app-cat-badge.cat-other {
  background: #d1fae5;
  color: #047857;
}

.app-bar-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.app-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-bar-fill.cat-game {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.app-bar-fill.cat-communication {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.app-bar-fill.cat-other {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.app-duration-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 90px;
  flex-shrink: 0;
}

.app-dur-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-heading);
}

.app-pct-val {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Interactive Skeleton Rows for Most Used Apps List */
.app-skeleton-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.app-skeleton-row:last-child {
  border-bottom: none;
}

.app-skeleton-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f1f5f9;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.app-skeleton-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-skeleton-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skeleton-line-title {
  width: 140px;
  height: 14px;
  border-radius: 4px;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.skeleton-line-badge {
  width: 52px;
  height: 14px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.skeleton-bar-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.app-skeleton-dur {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  min-width: 90px;
  flex-shrink: 0;
}

.skeleton-dur-val {
  width: 60px;
  height: 15px;
  border-radius: 4px;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.skeleton-dur-pct {
  width: 36px;
  height: 12px;
  border-radius: 4px;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

/* Shimmer Sweep Animation on all skeleton elements */
.app-skeleton-icon::after,
.skeleton-line-title::after,
.skeleton-line-badge::after,
.skeleton-bar-track::after,
.skeleton-dur-val::after,
.skeleton-dur-pct::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.85) 50%, transparent 100%);
  animation: shimmerSweep 1.4s infinite;
}

@keyframes shimmerSweep {
  100% {
    transform: translateX(100%);
  }
}

/* Refresh Status on Chart Header */
.chart-refresh-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.chart-refresh-status.spinning i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================
   10. Clean SaaS Modals (Pairing & Geofencing)
   ============================================================ */
.modal,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.active,
.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dropdown);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
  max-width: 720px;
}

.modal-card.modal-xl,
.snapshot-modal-card {
  max-width: 980px;
  width: 96vw;
}

.snapshot-modal-body {
  padding: 24px !important;
  display: grid !important;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  max-height: 84vh;
  overflow-y: auto;
}

@media (max-width: 820px) {
  .snapshot-modal-body {
    grid-template-columns: 1fr !important;
    gap: 20px;
    padding: 16px !important;
  }
}

.snapshot-preview-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.snapshot-img-frame {
  position: relative;
  width: 100%;
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  min-height: 380px;
  max-height: 520px;
}

.snapshot-img-frame img {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
}

.snapshot-res-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.snapshot-details-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.snapshot-details-header h4 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.snapshot-details-header .meta-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.snapshot-meta-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.meta-row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.meta-row-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.meta-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.meta-row-icon.icon-blue {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.meta-row-icon.icon-indigo {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.meta-row-icon.icon-emerald {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.meta-row-icon.icon-rose {
  background: rgba(244, 63, 94, 0.1);
  color: #e11d48;
}

.meta-row-icon.icon-sky {
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
}

.meta-row-icon.icon-amber {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.meta-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.meta-row-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-row-value {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-row-value.mono {
  font-family: monospace;
  font-size: 0.82rem;
  color: #0369a1;
}

.snapshot-details-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.modal-icon.geofence-icon-accent {
  background: var(--indigo-subtle);
  color: var(--indigo);
}

.modal-header-text h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-heading);
}

.modal-header-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-heading);
}

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface-subtle);
}

/* Pairing Modal Content */
.code-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.code-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.code-digits {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--primary);
  font-family: monospace;
}

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
}

#qrcode {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#qrcode canvas[style*="none"],
#qrcode img[style*="none"] {
  display: none !important;
}

.qr-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.connection-links-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connection-links-box h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-heading);
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
}

.link-tag {
  color: var(--text-muted);
}

.link-value {
  font-family: monospace;
  font-weight: 600;
  color: var(--primary);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Geofence Modal Elements */
.geofence-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.gf-tab-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.gf-tab-btn i { font-size: 0.9rem; }
.gf-tab-btn:hover { background: var(--bg-surface-subtle); color: var(--text-heading); }
.gf-tab-btn.active { background: var(--indigo-subtle); color: var(--indigo); }

.geofence-create-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.geofence-create-box h4 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-heading);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field {
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.84rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-heading);
  outline: none;
  transition: var(--transition);
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.slider-field {
  accent-color: var(--primary);
  cursor: pointer;
}

.radius-indicator {
  font-weight: 700;
  color: var(--primary);
}

.form-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-row label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.color-options {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-option input { display: none; }

.color-dot {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border-light);
  transition: var(--transition);
}

.color-option input:checked + .color-dot {
  box-shadow: 0 0 0 2px var(--primary);
  transform: scale(1.1);
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.geofence-list-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.geofence-list-box h4 {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-heading);
}

.geofence-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.geofence-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.geofence-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.geofence-card-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-heading);
}

.geofence-card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.geofence-card-badge.inside {
  background: var(--success-subtle);
  color: var(--success);
}

.geofence-card-badge.outside {
  background: var(--danger-subtle);
  color: var(--danger);
}

.geofence-card-details {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.geofence-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.geofence-card-dist {
  font-size: 0.72rem;
  color: var(--text-body);
}

.btn-card-delete {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-card-delete:hover {
  text-decoration: underline;
}

.geofence-events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.geofence-events-header h4 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-heading);
}

.geofence-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.geofence-event-row {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}

.event-type-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.event-type-pill.enter {
  background: var(--success-subtle);
  color: var(--success);
}

.event-type-pill.exit {
  background: var(--danger-subtle);
  color: var(--danger);
}

.event-desc {
  color: var(--text-body);
  flex: 1;
  margin: 0 14px;
}

.event-time {
  color: var(--text-light);
  font-size: 0.72rem;
}

.empty-state-mini {
  padding: 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.82rem;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-widgets-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .saas-layout { flex-direction: column; }
  .saas-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .kpi-grid { grid-template-columns: 1fr; }
  .saas-header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .saas-content {
    padding: 16px 20px 32px;
  }
}

/* ============================================================
   CUSTOM PARENT MAP PIN (GREEN TEARDROP LOCATION ICON - SESUAI PERMINTAAN USER)
   ============================================================ */
.parent-location-map-pin {
  background: transparent !important;
  border: none !important;
}

.parent-pin-wrapper {
  position: relative;
  width: 44px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.parent-pin-tag {
  position: absolute;
  top: -24px;
  background: #065f46;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(6, 95, 70, 0.35);
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.parent-pin-pulse {
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.45);
  animation: pulse-parent-ring 2.2s infinite ease-out;
  pointer-events: none;
}

.parent-pin-svg-box {
  position: relative;
  width: 42px;
  height: 50px;
  filter: drop-shadow(0 6px 12px rgba(16, 185, 129, 0.5));
  cursor: grab;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.parent-pin-svg-box:hover {
  transform: translateY(-4px) scale(1.08);
}

@keyframes pulse-parent-ring {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0.85; }
  70% { transform: translateX(-50%) scale(2.4); opacity: 0; }
  100% { transform: translateX(-50%) scale(2.6); opacity: 0; }
}

.parent-popup-content {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--text-heading);
  line-height: 1.45;
  min-width: 220px;
}

.parent-popup-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #059669;
  margin-bottom: 6px;
}

.geo-notice-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.74rem;
  color: #166534;
  margin: 8px 0;
  line-height: 1.35;
}

.btn-sync-position {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
}

.btn-sync-position:hover {
  background: #047857;
}

/* ============================================================
   PROGRESSIVE WEB APP (PWA) & MOBILE RESPONSIVE STYLES
   ============================================================ */

/* Desktop Default (Hidden on Large Screens) */
.mobile-bottom-nav,
.mobile-action-sheet,
.mobile-action-sheet-backdrop,
.mobile-header-btn,
.ios-install-modal {
  display: none;
}

/* PWA Install Notification Banner */
.pwa-install-banner {
  margin: 12px 24px 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
  animation: slideDownFade 0.3s ease-out;
}

@keyframes slideDownFade {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.pwa-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  flex-shrink: 0;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
}

.pwa-banner-text strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0369a1;
}

.pwa-banner-text span {
  font-size: 0.74rem;
  color: #0284c7;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-dismiss-btn {
  background: transparent;
  border: none;
  color: #0284c7;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.pwa-dismiss-btn:hover {
  background: rgba(2, 132, 199, 0.1);
}

/* ============================================================
   INFO & QUICK ACTIONS PAGE STYLES (GLOBAL & DESKTOP)
   ============================================================ */
#view-info {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.info-pwa-card {
  overflow: hidden;
}

.info-pwa-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-pwa-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.info-pwa-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #0284c7;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.info-pwa-text h3 {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.info-pwa-text p {
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}

.info-pwa-features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pwa-feat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-body);
}

.pwa-feat-item i {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.info-pwa-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-pwa-actions .btn {
  padding: 10px 20px;
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.info-pwa-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #92400e;
  line-height: 1.45;
}

.info-pwa-hint i {
  color: #f59e0b;
  font-size: 0.95rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.pwa-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
  white-space: nowrap;
}

.pwa-status-badge.installed {
  background: #dcfce7;
  color: #059669;
  border-color: #a7f3d0;
}

.info-action-list {
  display: flex;
  flex-direction: column;
}

.info-action-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  text-decoration: none !important;
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  color: inherit !important;
  background: var(--bg-surface);
}

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

.info-action-item:hover {
  background: var(--bg-surface-subtle);
  text-decoration: none !important;
}

.info-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.info-action-icon.sky { background: #e0f2fe; color: #0284c7; }
.info-action-icon.indigo { background: #e0e7ff; color: #4f46e5; }
.info-action-icon.purple { background: #f3e8ff; color: #9333ea; }
.info-action-icon.emerald { background: #dcfce7; color: #059669; }

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

.info-action-info strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-heading);
}

.info-action-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.info-action-arrow {
  color: #94a3b8;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.info-action-item:hover .info-action-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* Telegram Bot Notification Integration Card */
.tg-config-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}

.tg-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tg-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.tg-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.8rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-heading);
  transition: var(--transition);
  box-sizing: border-box;
}

.tg-input-wrapper .tg-input {
  padding-right: 36px;
}

.tg-input:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.tg-toggle-pw-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}

.tg-toggle-pw-btn:hover {
  color: var(--primary);
}

.tg-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.tg-switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-heading);
  user-select: none;
}

.tg-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-btn-group .btn {
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tg-guide-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 12px;
}

.tg-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
}

.tg-guide-content {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #bae6fd;
}

/* 2-Column Grid for System Health / Security (Global & Desktop) */
.widget-body.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  padding: 18px 20px;
}

.widget-body.grid-2col .health-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.widget-body.grid-2col .health-item:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.widget-body.grid-2col .health-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.widget-body.grid-2col .health-icon.sky { background: #e0f2fe; color: #0284c7; }
.widget-body.grid-2col .health-icon.emerald { background: #dcfce7; color: #059669; }
.widget-body.grid-2col .health-icon.amber { background: #fef3c7; color: #d97706; }
.widget-body.grid-2col .health-icon.purple { background: #f3e8ff; color: #9333ea; }

.widget-body.grid-2col .health-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.widget-body.grid-2col .health-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.widget-body.grid-2col .health-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-heading);
}

/* ============================================================
   TABLET RESPONSIVENESS (<= 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .saas-content {
    padding: 20px 20px 32px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .overview-secondary-grid,
  .activity-grid,
  .camera-workspace-grid,
  .location-workspace-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ============================================================
   MOBILE RESPONSIVENESS (<= 768px - AirDroid / Native Phone UX)
   ============================================================ */
@media (max-width: 768px) {
  /* 1. Hide Desktop Sidebar Completely */
  .saas-sidebar {
    display: none !important;
  }

  .saas-layout {
    display: block;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: clip; /* clip overflow without breaking position: sticky */
  }

  .saas-main {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: clip; /* clip overflow without breaking position: sticky */
    /* Extra padding at bottom for the Mobile Bottom Navigation Bar */
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* 2. Mobile App Header (Sticky on all views, vibrant blue theme with curved bottom corners) */
  .saas-header {
    height: auto !important;
    min-height: 54px !important;
    padding: 8px 12px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    background: #0284c7 !important;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-bottom-left-radius: 20px !important;
    border-bottom-right-radius: 20px !important;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.25) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
  }

  /* Left: Device Selector (Align Left) */
  .nav-device-selector {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
    flex: 0 1 auto !important;
    margin-right: auto !important;
    justify-content: flex-start !important;
    overflow: visible !important;
    position: relative !important;
  }

  .nav-device-trigger {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 2px 4px !important;
    border-radius: 8px !important;
    min-width: 0 !important;
    width: auto !important;
    justify-content: flex-start !important;
    background: transparent !important;
    transition: background 0.15s ease, opacity 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
  }

  /* Prevent solid white box on hover/focus/tap on mobile header */
  .nav-device-trigger:hover,
  .nav-device-trigger:focus {
    background: transparent !important;
  }

  .nav-device-trigger:active {
    background: rgba(255, 255, 255, 0.15) !important;
  }

  .nav-device-dropdown {
    top: calc(100% + 12px) !important;
    left: 0 !important;
    width: 260px !important;
    max-width: calc(100vw - 28px) !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25) !important;
    z-index: 2000 !important;
  }

  .nav-device-avatar svg {
    width: 26px !important;
    height: 26px !important;
    flex-shrink: 0 !important;
  }

  .nav-device-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 4px 6px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    justify-content: flex-start !important;
  }

  .nav-device-title-row {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    flex-shrink: 0 !important;
  }

  .nav-device-name {
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    max-width: 80px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .nav-device-chevron {
    font-size: 10px !important;
    color: rgba(255, 255, 255, 0.8) !important;
  }

  .nav-device-pills {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 1 !important;
    overflow: hidden !important;
  }

  .nav-device-pills .device-pill {
    padding: 2px 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    height: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    white-space: nowrap !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
  }

  .nav-device-pills .device-pill i {
    color: #ffffff !important;
  }

  /* Right: Header Actions / Status Pill (Align Right) */
  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    justify-content: flex-end !important;
  }

  .header-actions #btnWakeChild,
  .header-actions #btnOpenUrlSync,
  .header-actions #btnOpenPairing,
  .mobile-header-btn {
    display: none !important;
  }

  /* Active Status Pill on Header (Align Right) */
  #deviceStatusPill,
  .nav-status-pill,
  .device-status-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 3px 9px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    height: 26px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  #deviceStatusPill.connected,
  .nav-status-pill.online,
  .device-status-badge.connected {
    background: #ecfdf5 !important;
    border: 1px solid #a7f3d0 !important;
    color: #059669 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
  }

  #deviceStatusPill .status-dot,
  .nav-status-pill .status-dot-sm,
  .nav-status-pill .status-dot {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
    box-shadow: 0 0 6px #10b981 !important;
    flex-shrink: 0 !important;
  }

  #deviceStatusPill .status-label,
  .nav-status-pill .status-text-sm,
  .nav-status-pill .status-label {
    color: #059669 !important;
    font-weight: 700 !important;
    font-size: 11px !important;
  }

  .mobile-header-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-light) !important;
    color: #0f172a !important;
    font-size: 1.15rem !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: background 0.15s ease, transform 0.1s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .mobile-header-btn:active {
    background: var(--bg-surface-hover) !important;
    transform: scale(0.95) !important;
  }

  /* 3. Mobile Content Layout */
  .saas-content {
    padding: 10px 12px 24px !important;
  }

  .pwa-install-banner {
    margin: 8px 12px 4px !important;
    padding: 10px 12px !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    box-sizing: border-box !important;
  }

  body.saas-view-location-active .pwa-install-banner,
  .saas-main:has(#view-location.active) .pwa-install-banner {
    display: none !important;
  }

  /* KPI Grid & Cards (Point 1 - Contrast & 11-12px Font) */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .kpi-card {
    padding: 10px 10px !important;
    gap: 8px !important;
    border-radius: var(--radius-md) !important;
    min-height: 64px !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }

  .kpi-icon-box {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
  }

  .kpi-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important; /* WCAG AA contrast */
  }

  .kpi-value {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    line-height: 1.2 !important;
  }

  .kpi-sub {
    font-size: 11.5px !important;
    font-weight: 500 !important;
    color: #475569 !important; /* WCAG AA contrast */
    line-height: 1.3 !important;
  }

  /* Secondary Grid & Cards (Point 2 - Reduce outer card padding) */
  .overview-widgets-grid,
  .overview-secondary-grid,
  .activity-grid,
  .camera-workspace-grid,
  .location-workspace-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .saas-card,
  .widget-card,
  .chart-card {
    border-radius: var(--radius-md) !important;
    margin-bottom: 0 !important;
  }

  .card-header {
    padding: 10px 14px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .card-header .card-title h2 {
    font-size: 0.92rem !important;
    font-weight: 800 !important;
  }

  .card-body,
  .widget-body {
    padding: 10px 14px 14px !important;
  }

  /* Tab Grafik (Point 4 - Min-height 40px, Horizontal Scroll) */
  .chart-card .card-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .chart-card .card-header > div:first-child {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .chart-card .card-header > div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .chart-refresh-status {
    font-size: 11.5px !important;
    color: #475569 !important;
    font-weight: 600 !important;
  }

  .chart-filter-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 2px 0 4px !important;
    margin: 0 !important;
  }

  .chart-filter-group::-webkit-scrollbar {
    display: none !important;
  }

  .chart-filter-group .filter-btn {
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  /* Grafik Baterai Area (Point 5 - Increase height +25-30% & Legend) */
  .chart-canvas-wrapper {
    height: 330px !important; /* +25-30% height on mobile */
    padding: 10px 10px 4px !important;
  }

  .chart-footer-meta {
    padding: 12px 14px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px 16px !important;
    background: var(--bg-surface-subtle) !important;
    border-top: 1px solid var(--border-subtle) !important;
  }

  .meta-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
  }

  .meta-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }

  /* 2-Column Grid (Point 2 & Point 3 - Health and Connectivity) */
  .widget-body.grid-2col {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px 10px !important;
  }

  .widget-body.grid-2col .health-item {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    background: #fbfcfd !important;
    border: 1px solid #edf2f6 !important;
    border-radius: 8px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .widget-body.grid-2col .health-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 6px !important;
    font-size: 0.82rem !important;
    margin-top: 1px !important;
    flex-shrink: 0 !important;
  }

  .widget-body.grid-2col .health-info {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .widget-body.grid-2col .health-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    line-height: 1.25 !important;
    margin-bottom: 2px !important;
  }

  .widget-body.grid-2col .health-val {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Posisi Terakhir Anak (Point 2 & Point 9) */
  .location-snapshot-card {
    background: transparent !important;
    border: none !important;
    padding: 2px 0 8px !important;
    display: flex !important;
    gap: 10px !important;
  }

  .loc-pin-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
    background: var(--primary-subtle) !important;
    color: var(--primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .loc-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .loc-title {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.3 !important;
  }

  .loc-sub {
    font-size: 11.5px !important;
    color: #475569 !important;
  }

  .loc-tag {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin-top: 4px !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    width: fit-content !important;
  }

  /* Distance Row & Button (Point 9 - 44x44px touch target) */
  .quick-distance-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 0 0 !important;
    margin-top: 8px !important;
    border-top: 1px solid var(--border-subtle) !important;
    background: transparent !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-radius: 0 !important;
  }

  .quick-dist-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important;
  }

  .quick-dist-val {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    color: var(--primary) !important;
    background: rgba(2, 132, 199, 0.08) !important;
    border: 1px solid rgba(2, 132, 199, 0.2) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: background 0.15s ease, transform 0.1s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
  }

  .quick-dist-val:active {
    background: rgba(2, 132, 199, 0.22) !important;
    transform: scale(0.96) !important;
  }

  /* Consistency of Badges and Links (Point 7 - Standardized 28px height, 11.5px font, 44px touch) */
  .badge-status-online,
  .badge-status-security,
  .widget-link-btn {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  .widget-link-btn {
    color: var(--primary) !important;
    background: var(--primary-subtle) !important;
    border: 1px solid var(--primary-border) !important;
    text-decoration: none !important;
    gap: 4px !important;
  }

  .widget-link-btn::after {
    content: '';
    position: absolute;
    inset: -8px -8px;
    min-width: 44px;
    min-height: 44px;
  }

  /* Empty state Log Keamanan (Point 8 - Tight & Proportional) */
  .overview-alerts-list .empty-state-mini {
    padding: 12px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    text-align: left !important;
    background: #f8fafc !important;
    border: 1px solid #edf2f7 !important;
    border-radius: var(--radius-sm) !important;
    min-height: auto !important;
  }

  .overview-alerts-list .empty-state-mini i {
    font-size: 1.35rem !important;
    color: #10b981 !important;
    flex-shrink: 0 !important;
  }

  .overview-alerts-list .empty-state-mini p {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
  }

  /* Top 3 Apps preview */
  .top-app-item {
    padding: 8px 10px !important;
    background: transparent !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
  }

  .top-app-name {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
  }

  .top-app-time {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
  }

  /* ============================================================
     3.5. App Activity Mobile View (Points 1 - 11)
     ============================================================ */
  /* Point 7: Date Header & Controls */
  .activity-top-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px 8px !important;
    margin-bottom: 14px !important;
  }

  .activity-top-left {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px 8px !important;
    width: 100% !important;
  }

  .activity-page-title {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 !important;
    letter-spacing: -0.02em !important;
  }

  .activity-period-toggle {
    display: inline-flex !important;
    background: #f1f5f9 !important;
    padding: 3px !important;
    border-radius: var(--radius-full) !important;
    border: 1px solid var(--border-light) !important;
  }

  .pill-toggle {
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: var(--radius-full) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
  }

  .activity-date-nav {
    display: inline-flex !important;
    align-items: center !important;
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-full) !important;
    padding: 2px 4px !important;
    box-shadow: var(--shadow-sm) !important;
    min-height: 40px !important;
  }

  .date-nav-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 50% !important;
    font-size: 0.85rem !important;
    color: #475569 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
  }

  .date-nav-btn:active {
    background: #f1f5f9 !important;
    transform: scale(0.95) !important;
  }

  .date-nav-display {
    padding: 0 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    white-space: nowrap !important;
  }

  .activity-top-right {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 8px !important;
    padding-top: 2px !important;
  }

  .activity-update-time {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #475569 !important; /* WCAG AA */
  }

  .btn-icon-refresh {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
    color: #475569 !important;
    cursor: pointer !important;
  }

  .btn-icon-refresh:active {
    background: #f1f5f9 !important;
    transform: scale(0.95) !important;
  }

  /* Point 5 & 9: Screen Time Card & Trend Badge */
  .screen-time-card {
    padding: 14px 14px 16px !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 12px !important;
  }

  .screen-time-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .screen-time-meta {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }

  .meta-date {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important; /* WCAG AA */
  }

  .total-screen-time-val {
    font-size: 1.85rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    letter-spacing: -0.02em !important;
    line-height: 1.15 !important;
  }

  /* Point 9: Standardize comparison trend badge (28px height, 6px radius, 11.5px font) */
  .comparison-trend-badge {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
  }

  /* Point 6: Screen Time Chart Container +30% height */
  .screen-time-chart-container {
    height: 315px !important; /* +30% from 240px */
    margin-bottom: 16px !important;
  }

  /* Point 5: Category Section Title */
  .category-breakdown-section {
    border-top: 1px solid var(--border-subtle) !important;
    padding-top: 14px !important;
  }

  .category-section-title {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important; /* WCAG AA */
    margin-bottom: 10px !important;
    display: block !important;
  }

  /* Point 8: Category Cards */
  .category-cards-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .category-card {
    padding: 12px 14px !important;
    border-radius: 10px !important;
    gap: 4px !important;
  }

  .cat-card-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .cat-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }

  .cat-name {
    font-size: 12.5px !important;
    font-weight: 700 !important;
  }

  .cat-duration {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
    line-height: 1.2 !important;
  }

  /* Point 10: Most Used Apps Card & Sticky Header */
  .most-used-apps-card {
    border-radius: var(--radius-md) !important;
    margin-bottom: 12px !important;
    overflow: visible !important;
  }

  .most-used-apps-card .card-header {
    position: sticky !important;
    top: 56px !important;
    z-index: 20 !important;
    background: #ffffff !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  }

  /* Point 9: Standardize apps-count-badge */
  .apps-count-badge {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
  }

  /* Point 1: App Rows Height 56-64px & Subtle Divider */
  .most-used-app-row {
    min-height: 60px !important;
    padding: 10px 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background 0.15s ease !important;
  }

  .most-used-app-row:nth-child(even) {
    background: #fafbfc !important;
  }

  .most-used-app-row:last-child {
    border-bottom: none !important;
  }

  .app-logo-box {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
  }

  .app-details-col {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .app-title-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
  }

  .app-name-text {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.25 !important;
  }

  /* Point 2: Category Badges */
  .app-cat-badge {
    height: 20px !important;
    min-height: 20px !important;
    padding: 0 7px !important;
    border-radius: 4px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    flex-shrink: 0 !important;
  }

  .app-cat-badge.cat-game {
    background: #dbeafe !important;
    color: #1e40af !important; /* Contrast 6.5:1 */
  }

  .app-cat-badge.cat-communication {
    background: #fef3c7 !important;
    color: #92400e !important; /* Contrast 6.2:1 */
  }

  .app-cat-badge.cat-other {
    background: #d1fae5 !important;
    color: #065f46 !important; /* Contrast 6.3:1 */
  }

  /* Point 3: Progress Bar 6px, Rounded, Minimum Width */
  .app-bar-track {
    width: 100% !important;
    height: 6px !important;
    background: #e2e8f0 !important;
    border-radius: 99px !important;
    overflow: hidden !important;
  }

  .app-bar-fill {
    height: 100% !important;
    border-radius: 99px !important;
    min-width: 4px !important;
  }

  /* Point 4: Duration & Percentage Right Column (Tabular-nums) */
  .app-duration-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: center !important;
    width: 82px !important;
    min-width: 82px !important;
    flex-shrink: 0 !important;
    font-variant-numeric: tabular-nums !important;
    font-feature-settings: "tnum" !important;
  }

  .app-dur-val {
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }

  .app-pct-val {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #475569 !important; /* WCAG AA */
    text-align: right !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
  }

  /* Skeleton loading row adjustments */
  .app-skeleton-row {
    min-height: 60px !important;
    padding: 10px 14px !important;
    gap: 12px !important;
  }

  .app-skeleton-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
  }

  .skeleton-bar-track {
    height: 6px !important;
  }

  /* 4. Remote Camera Mobile View (Clean Full-Bleed Output & Compact Controls) */
  .camera-studio-main {
    padding: 12px 14px 16px !important;
    gap: 12px !important;
  }

  .camera-studio-main .card-header {
    padding: 2px 2px 8px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .camera-studio-main .card-title {
    gap: 8px !important;
  }

  .camera-studio-main .card-title h2 {
    font-size: 1.12rem !important;
    font-weight: 800 !important;
  }

  .camera-header-right {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .camera-mode-toggle {
    display: inline-flex !important;
    gap: 4px !important;
  }

  .mode-btn {
    padding: 5px 9px !important;
    font-size: 0.72rem !important;
    border-radius: 8px !important;
  }

  /* Seamless Camera Stage without bulky borders or dotted margins */
  .camera-stage {
    padding: 0 !important;
    min-height: auto !important;
    background: transparent !important;
    background-image: none !important;
    border: none !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Viewport: Fills width cleanly with native phone aspect ratio */
  .camera-viewport {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    min-height: 380px !important;
    max-height: 62vh !important;
    border-radius: 18px !important;
    border: 2px solid #1e293b !important;
    background: #090d16 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
    position: relative !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .camera-viewport.mode-landscape {
    aspect-ratio: 16 / 9 !important;
    min-height: 200px !important;
    max-height: 45vh !important;
  }

  .camera-viewport.mode-portrait {
    aspect-ratio: 9 / 16 !important;
    min-height: 420px !important;
    max-height: 65vh !important;
  }

  /* Video Stream Output: Full bleed zero black pillarboxes */
  #remoteVideo {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 16px !important;
  }

  #remoteVideo.fit-contain {
    object-fit: contain !important;
  }

  /* Clean Placeholder State */
  .camera-placeholder {
    width: 100% !important;
    min-width: 0 !important;
    padding: 28px 16px !important;
    gap: 12px !important;
  }

  .placeholder-icon {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.35rem !important;
  }

  .placeholder-text {
    font-size: 0.84rem !important;
    max-width: 250px !important;
    line-height: 1.4 !important;
  }

  /* Compact In-Stream Floating Controls Overlay */
  .stream-controls {
    position: absolute !important;
    bottom: 10px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 4px 8px !important;
    border-radius: 9999px !important;
    background: rgba(15, 23, 42, 0.88) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
    z-index: 20 !important;
    max-width: calc(100% - 16px) !important;
  }

  .stream-controls[style*="display: none"],
  .cam-hud-top[style*="display: none"] {
    display: none !important;
  }

  .stream-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 50% !important;
    font-size: 0.8rem !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border: none !important;
    color: #ffffff !important;
    transition: transform 0.15s ease, background 0.15s ease !important;
  }

  .stream-btn:active {
    transform: scale(0.9) !important;
  }

  .stream-btn.danger {
    background: #ef4444 !important;
  }

  .stream-btn.active {
    background: #0284c7 !important;
  }

  .stream-btn.mic-active {
    background: #10b981 !important;
  }

  .stream-btn.flash-on {
    background: #f59e0b !important;
  }

  /* In-Feed HUD Badges (Single Row) */
  .cam-hud-top {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    display: flex;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    z-index: 15 !important;
    pointer-events: none !important;
  }

  .hud-group-left,
  .hud-group-right {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .hud-pill {
    font-size: 10px !important;
    padding: 3px 8px !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
  }

  .camera-footer {
    padding: 8px 4px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
  }

  .camera-footer .info-tag {
    font-size: 0.74rem !important;
  }

  /* Hardware Diagnostics Table Mobile Spacing & No Overlap */
  .studio-panel-card {
    padding: 12px 14px !important;
  }

  .studio-metrics-list {
    padding: 6px 4px 10px !important;
  }

  .studio-metric-row {
    gap: 10px !important;
    padding: 9px 0 !important;
    flex-wrap: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .metric-label {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.8rem !important;
  }

  .metric-val {
    text-align: right !important;
    word-break: break-word !important;
    font-size: 0.8rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 55% !important;
  }

  /* 5. Location & Map Mobile View (Full Screen Bleed Map & Compact Bottom Controls) */
  body.saas-view-location-active,
  body:has(#view-location.active) {
    overflow: hidden !important;
    height: 100dvh !important;
  }

  body.saas-view-location-active .saas-main,
  .saas-main:has(#view-location.active) {
    height: 100dvh !important;
    overflow: hidden !important;
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .saas-view.view-map-fullscreen {
    position: relative !important;
    width: 100% !important;
    height: calc(100dvh - 56px - 62px - env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100vh - 56px - 62px) !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .saas-view.view-map-fullscreen.active {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .view-map-fullscreen .map-viewport-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .view-map-fullscreen #map {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    z-index: 10 !important;
  }

  /* Compact Floating Controls Docked at Bottom Above Mobile Nav */
  .map-floating-panel {
    position: absolute !important;
    top: auto !important;
    bottom: 10px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100% - 20px) !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-radius: 14px !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.05) !important;
    z-index: 1000 !important;
    overflow: hidden !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease !important;
  }

  .panel-header {
    padding: 7px 12px 3px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .panel-title {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    color: var(--text-heading) !important;
    letter-spacing: -0.01em !important;
  }

  .panel-refresh-btn {
    font-size: 0.75rem !important;
    padding: 4px 6px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--text-muted) !important;
    border-radius: 6px !important;
  }

  .panel-device-card {
    padding: 3px 12px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .panel-device-top {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
  }

  .panel-device-avatar {
    flex-shrink: 0 !important;
    margin-top: 0 !important;
  }

  .panel-device-avatar svg {
    width: 24px !important;
    height: 24px !important;
  }

  .panel-device-info {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    overflow: hidden !important;
  }

  .panel-device-name-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 6px !important;
  }

  .panel-device-name {
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    color: var(--text-heading) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .panel-device-time {
    font-size: 0.68rem !important;
    color: #64748b !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .panel-device-address {
    font-size: 0.68rem !important;
    color: #475569 !important;
    line-height: 1.25 !important;
    margin-top: 1px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .panel-actions-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
    margin-top: 2px !important;
  }

  .panel-action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 5px 6px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    min-height: 32px !important;
  }

  .panel-action-btn i {
    font-size: 0.72rem !important;
  }

  .badge-pro {
    font-size: 0.55rem !important;
    padding: 1px 3px !important;
    border-radius: 3px !important;
  }

  .panel-layer-tabs {
    display: flex !important;
    padding: 2px !important;
    border-radius: 6px !important;
    gap: 3px !important;
    margin-top: 2px !important;
  }

  .layer-tab {
    padding: 4px 6px !important;
    font-size: 0.7rem !important;
    height: 26px !important;
    gap: 4px !important;
    border-radius: 5px !important;
  }

  .layer-tab i {
    font-size: 0.68rem !important;
  }

  /* Collapsed state for floating panel on mobile */
  .map-floating-panel.collapsed .panel-device-card {
    display: none !important;
  }

  .map-floating-panel.collapsed {
    padding-bottom: 4px !important;
  }

  /* Leaflet Controls on Mobile */
  .view-map-fullscreen .leaflet-bottom.leaflet-right {
    bottom: 200px !important;
    right: 12px !important;
  }

  .view-map-fullscreen .leaflet-control-attribution {
    font-size: 9px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
  }

  /* Zoom Controls: Top Left, directly below sticky header */
  .view-map-fullscreen .leaflet-top.leaflet-left {
    top: 14px !important;
    bottom: auto !important;
    left: 14px !important;
    margin: 0 !important;
    z-index: 900 !important;
  }

  .view-map-fullscreen .leaflet-control-zoom {
    border-radius: 10px !important;
    border: 1px solid var(--border-light) !important;
    overflow: hidden !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    margin: 0 !important;
  }

  .view-map-fullscreen .leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 15px !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    transition: background 0.15s ease !important;
  }

  .view-map-fullscreen .leaflet-control-zoom a:active {
    background: #f1f5f9 !important;
  }

  /* When floating panel is collapsed, adjust bottom controls */
  .view-map-fullscreen:has(.map-floating-panel.collapsed) .leaflet-bottom.leaflet-right {
    bottom: 60px !important;
  }

  /* 6. Mobile Bottom Navigation Bar (White Background, Gray Inactive, Blue Active) */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    height: 60px !important;
    background: #ffffff !important;
    border-top: 1px solid var(--border-light) !important;
    box-shadow: 0 -3px 12px rgba(15, 23, 42, 0.07) !important;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    align-items: center;
    justify-content: space-around;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    padding: 6px 4px;
    transition: var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* Inactive icon: gray */
  .bottom-nav-item i {
    font-size: 1.25rem;
    color: #64748b !important;
    -webkit-text-stroke: 0 transparent !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Inactive label: gray */
  .bottom-nav-item span {
    font-size: 10.5px !important;
    font-weight: 500;
    color: #64748b !important;
    transition: color 0.2s ease, font-weight 0.2s ease;
  }

  /* Active icon: primary blue */
  .bottom-nav-item.active i {
    color: #0284c7 !important;
    -webkit-text-stroke: 0 transparent !important;
    transform: scale(1.12);
  }

  /* Active label: primary blue bold */
  .bottom-nav-item.active span {
    color: #0284c7 !important;
    font-weight: 800 !important;
  }

  /* 7. View Info & Quick Actions Page Styles */
  .info-pwa-body {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .info-pwa-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 12px 14px;
  }

  .info-pwa-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #0284c7;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
  }

  .info-pwa-text h3 {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 2px;
  }

  .info-pwa-text p {
    font-size: 0.76rem;
    color: #475569;
    line-height: 1.35;
    margin: 0;
  }

  .info-pwa-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .pwa-feat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-body);
  }

  /* Info Page Header Subtitle font reduction (Request 1) */
  .info-pwa-card .card-title .card-sub {
    font-size: 0.72rem !important; /* ~11.5px */
    color: #64748b !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    display: block !important;
    margin-top: 1px !important;
  }

  /* Info Page PWA Action Buttons side-by-side (Request 2) */
  .info-pwa-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .info-pwa-actions .btn {
    flex: 1 1 0% !important;
    width: auto !important;
    padding: 9px 8px !important;
    font-size: 0.76rem !important;
    white-space: nowrap !important;
    justify-content: center !important;
  }

  .info-pwa-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.72rem;
    color: #92400e;
    line-height: 1.35;
  }

  .info-action-list {
    display: flex;
    flex-direction: column;
  }

  .info-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
    color: inherit;
  }

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

  .info-action-item:hover,
  .info-action-item:active {
    background: var(--bg-surface-subtle);
  }

  .info-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .info-action-icon.sky { background: #e0f2fe; color: #0284c7; }
  .info-action-icon.indigo { background: #e0e7ff; color: #4f46e5; }
  .info-action-icon.purple { background: #f3e8ff; color: #9333ea; }
  .info-action-icon.emerald { background: #dcfce7; color: #059669; }

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

  .info-action-info strong {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-heading);
  }

  .info-action-info span {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
  }

  .info-action-arrow {
    color: #94a3b8;
    font-size: 0.78rem;
  }

  /* Telegram Card Mobile Overrides */
  .tg-config-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .tg-action-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .tg-btn-group {
    display: flex !important;
    width: 100% !important;
  }

  .tg-btn-group .btn {
    flex: 1 1 0% !important;
    justify-content: center !important;
  }

  /* 7. Mobile Action Sheet (Slide-up Drawer) */
  .mobile-action-sheet-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .mobile-action-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-action-sheet {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: 20px 20px 0 0;
    z-index: 1100;
    box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.2);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 85vh;
    overflow-y: auto;
    padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-action-sheet.open {
    transform: translateY(0);
  }

  .sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 99px;
    margin: 10px auto 14px;
  }

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

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

  .sheet-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface-subtle);
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
  }

  .sheet-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 4px 6px;
  }

  .sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-heading);
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
  }

  .sheet-item:active {
    background: var(--bg-surface-hover);
    transform: scale(0.98);
  }

  /* PWA Elements in Hamburger Action Sheet */
  .pwa-header-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    background: #e0f2fe;
    color: #0284c7;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    border: 1px solid #bae6fd;
    line-height: 1;
  }

  .pwa-header-pill.active {
    background: #dcfce7;
    color: #059669;
    border-color: #a7f3d0;
  }

  .sheet-pwa-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
    margin-bottom: 12px;
  }

  .sheet-pwa-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  .sheet-pwa-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #0284c7;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
  }

  .sheet-pwa-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .sheet-pwa-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
  }

  .sheet-pwa-title-row strong {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
  }

  .pwa-status-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: #ffffff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    white-space: nowrap;
  }

  .pwa-status-badge.installed {
    background: #dcfce7;
    color: #059669;
    border-color: #a7f3d0;
  }

  .sheet-pwa-text p {
    font-size: 0.76rem;
    color: #334155;
    margin: 0;
    line-height: 1.35;
  }

  .sheet-pwa-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(186, 230, 253, 0.6);
  }

  .pwa-feat-item {
    font-size: 0.72rem;
    font-weight: 600;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .pwa-feat-item i {
    font-size: 0.75rem;
    color: #0284c7;
  }

  .sheet-pwa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
  }

  .sheet-pwa-install-btn {
    flex: 1.2;
    min-height: 38px;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
  }

  .sheet-pwa-guide-btn {
    flex: 1;
    min-height: 38px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    transition: var(--transition);
  }

  .sheet-pwa-guide-btn:hover {
    background: #f8fafc;
    color: #0f172a;
  }

  .sheet-pwa-hint {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.7rem;
    color: #475569;
    line-height: 1.35;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px 8px;
    border-radius: 6px;
  }

  .sheet-pwa-hint i {
    color: #0284c7;
    margin-top: 2px;
    flex-shrink: 0;
  }

  .sheet-item.pwa-sheet-item {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-color: #bae6fd;
  }

  .sheet-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
  }

  .sheet-item-icon.install-icon {
    background: #0284c7;
    color: #fff;
  }

  .sheet-item-icon.sky {
    background: #e0f2fe;
    color: #0284c7;
  }

  .sheet-item-icon.indigo {
    background: #e0e7ff;
    color: #4f46e5;
  }

  .sheet-item-icon.purple {
    background: #f3e8ff;
    color: #9333ea;
  }

  .sheet-item-icon.emerald {
    background: #dcfce7;
    color: #059669;
  }

  .sheet-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .sheet-item-info strong {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-heading);
  }

  .sheet-item-info span {
    font-size: 0.72rem;
    color: var(--text-muted);
  }

  .sheet-chevron {
    color: var(--text-light);
    font-size: 0.85rem;
  }

  /* 8. Mobile Responsive Modals (Clean margins, compact contents, smooth scroll) */
  .modal,
  .modal-backdrop {
    padding: 24px 16px !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1200 !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: 340px !important;
    max-height: calc(100dvh - 120px) !important;
    margin: auto !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.35) !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  .modal-card.modal-lg,
  .modal-card.modal-xl,
  .snapshot-modal-card {
    max-width: 340px !important;
  }

  .modal-header {
    padding: 10px 14px !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  .modal-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.85rem !important;
    border-radius: 7px !important;
    flex-shrink: 0 !important;
  }

  .modal-header-text h3 {
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
  }

  .modal-header-text p {
    font-size: 0.68rem !important;
    margin: 0 !important;
    line-height: 1.25 !important;
  }

  .modal-close-btn {
    top: 8px !important;
    right: 8px !important;
    width: 24px !important;
    height: 24px !important;
    font-size: 1.1rem !important;
  }

  .modal-body {
    padding: 10px 12px !important;
    gap: 8px !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .modal-footer {
    padding: 8px 12px !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  .modal-footer .btn {
    padding: 6px 12px !important;
    font-size: 0.74rem !important;
    border-radius: 8px !important;
  }

  /* Specific elements inside Pairing / URL Sync / Add Device Modals */
  .code-box {
    padding: 8px 10px !important;
    border-radius: 8px !important;
    gap: 2px !important;
  }

  .code-label {
    font-size: 0.62rem !important;
    letter-spacing: 0.05em !important;
  }

  .code-digits {
    font-size: 1.35rem !important;
    letter-spacing: 0.12em !important;
  }

  #btnCopyCode {
    padding: 3px 8px !important;
    font-size: 0.68rem !important;
    gap: 4px !important;
  }

  .qr-section {
    padding: 2px 0 !important;
    gap: 4px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #qrcode {
    padding: 8px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  }

  #qrcode canvas[style*="none"],
  #qrcode img[style*="none"] {
    display: none !important;
  }

  #qrcode img,
  #qrcode canvas {
    max-width: 124px !important;
    max-height: 124px !important;
    width: 124px !important;
    height: 124px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
  }

  .qr-hint {
    font-size: 0.68rem !important;
    line-height: 1.25 !important;
    max-width: 250px !important;
  }

  .connection-links-box {
    padding: 6px 10px !important;
    gap: 4px !important;
    border-radius: 8px !important;
  }

  .connection-links-box h4 {
    font-size: 0.68rem !important;
    margin-bottom: 2px !important;
  }

  .link-item {
    font-size: 0.66rem !important;
  }

  .link-value {
    max-width: 150px !important;
    font-size: 0.65rem !important;
  }

  /* URL Sync Section in Modal */
  .url-sync-card {
    padding: 8px 10px !important;
    border-radius: 8px !important;
    margin-top: 4px !important;
  }

  .url-sync-card span {
    font-size: 0.74rem !important;
  }

  .url-sync-card p {
    font-size: 0.68rem !important;
    margin-bottom: 6px !important;
    line-height: 1.3 !important;
  }

  .url-sync-card input {
    padding: 5px 8px !important;
    font-size: 0.7rem !important;
  }

  .url-sync-card .btn {
    padding: 5px 8px !important;
    font-size: 0.7rem !important;
    white-space: nowrap !important;
  }
}

/* ============================================================
   EXTRA SMALL MOBILE (<= 480px)
   ============================================================ */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .kpi-card {
    padding: 10px 8px;
  }

  .kpi-value {
    font-size: 1rem;
  }

  .nav-device-info .nav-device-pills {
    display: none;
  }
}

/* iOS Safari PWA Install Modal */
.ios-install-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.ios-modal-content {
  background: var(--bg-surface);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.ios-modal-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ios-step {
  font-size: 0.84rem;
  color: var(--text-body);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.ios-step .step-num {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}


