:root {
  --background: #f4f6f9;
  --foreground: #2d3748;
  --card: #ffffff;
  --primary: #17a2b8;
  --primary-foreground: #ffffff;
  --secondary: #f8fafc;
  --muted-foreground: #718096;
  --destructive: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
  --warning-foreground: #2d3748;
  --orange: #fd7e14;
  --border: #e2e8f0;
  --ring: #17a2b8;
  --sidebar-bg: #1e2229;
  --sidebar-fg: #ffffff;
  --sidebar-active: #17a2b8;
  --sidebar-hover: #2a3040;
  --topbar-bg: #1e2229;
  --login-bg: #e9ecef;
  --radius: 10px;
  --radius-pill: 20px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  overflow: hidden;
}
.login-accent { height: 4px; background: var(--primary); }
.login-body { padding: 32px; }
.login-logo { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.logo-sq { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.logo-sq-1 { background: #00BFFF; }
.logo-sq-2 { background: #1A56DB; }
.logo-sq-3 { background: #0d3b8c; }
.login-title { text-align: center; font-size: 1.5rem; margin: 0 0 4px; color: #1a202c; }
.login-title span { font-weight: 400; }
.login-subtitle { text-align: center; color: var(--muted-foreground); font-size: 0.875rem; margin: 0 0 24px; }
.login-error { color: var(--destructive); font-size: 0.875rem; margin-bottom: 12px; text-align: center; }
.field-group { margin-bottom: 16px; position: relative; }
.field-group input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: box-shadow 0.2s ease;
}
.field-group input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.field-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
}

/* App shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 48px;
  background: var(--topbar-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1rem; font-weight: 600; margin: 0; }
.topbar-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.25rem;
  cursor: pointer;
}
.topbar-logout { color: rgba(255,255,255,0.7); font-size: 0.875rem; }
.topbar-logout:hover { color: #fff; text-decoration: none; }

.app-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 48px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s ease;
  position: relative;
  z-index: 40;
}
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-group-label { display: none; }
body.sidebar-collapsed .nav-link { justify-content: center; padding: 12px; }
body.sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--sidebar-hover);
}
.logo-squares { display: flex; gap: 4px; flex-shrink: 0; }
.sidebar-brand-text { font-weight: 600; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-group { margin-bottom: 8px; }
.nav-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  padding: 8px 16px 4px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--primary); text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-icon { width: 20px; text-align: center; }

.sidebar-collapse-btn {
  margin: 12px auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--sidebar-hover);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}
.sidebar-collapse-btn:hover { background: var(--sidebar-active); }
.sidebar-collapse-btn i { transition: transform 0.25s ease; }

.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px;
}
.page-content { max-width: 100%; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 24px;
  margin-bottom: 24px;
}
.card-title { font-size: 1.25rem; font-weight: 700; color: #1a202c; margin: 0 0 16px; }
.card-subtitle { font-size: 0.875rem; color: var(--muted-foreground); margin: -8px 0 16px; }
.card-header-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

/* Form */
.form-label { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); margin-bottom: 6px; }
.form-control, select.form-control {
  width: 100%;
  max-width: 288px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.875rem;
  transition: box-shadow 0.2s ease;
}
.form-control:focus, select.form-control:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.form-control-sm { max-width: none; padding: 8px 10px; font-size: 0.8125rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.form-group { flex: 1; min-width: 140px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: var(--warning-foreground); }
.btn-danger { background: var(--destructive); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 0.75rem; }
.btn-block { width: 100%; padding: 12px; font-size: 1rem; }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  list-style: none;
  padding: 4px 0;
  z-index: 100;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--foreground);
  font-size: 0.875rem;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--secondary); }

/* Status */
.status-block { text-align: right; font-size: 0.875rem; }
.status-block .label { color: var(--muted-foreground); }
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-up, .pill-live { background: var(--success); color: #fff; }
.pill-down { background: var(--destructive); color: #fff; }
.pill-waiting { background: var(--orange); color: #fff; animation: pulse-badge 2s ease-in-out infinite; }
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 280px;
}
.search-box input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
  border-right: none;
}
.search-box button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  background: var(--secondary);
  cursor: pointer;
}
.loading-msg { color: var(--destructive); font-size: 1.25rem; display: none; }
.loading-msg.visible { display: inline; }
.table-loading-shell {
  position: relative;
  min-height: 180px;
}
.table-loading-content {
  transition: color 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}
.table-loading-shell.is-loading .table-loading-content {
  color: var(--primary);
  opacity: 0.45;
  filter: saturate(1.2);
  pointer-events: none;
}
.table-loading-shell.is-loading .table-loading-content table,
.table-loading-shell.is-loading .table-loading-content th,
.table-loading-shell.is-loading .table-loading-content td {
  color: var(--primary);
}
.table-loading-shell .table-loading-pill {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border: 1px solid rgba(23, 162, 184, 0.25);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(23, 162, 184, 0.22);
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.table-loading-shell .table-loading-pill.visible {
  display: inline-flex;
}
.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  animation: loading-dot-bounce 0.8s ease-in-out infinite;
}
.loading-dots span:nth-child(2) {
  animation-delay: 0.12s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0.24s;
}
@keyframes loading-dot-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Multi-select dropdown (dimensions / metrics) */
.ms-select {
  position: relative;
  width: 100%;
}
.ms-select-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: #fff;
}
.ms-select-toggle .ms-select-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
}
.ms-select-toggle .ms-select-label.is-placeholder {
  color: var(--muted-foreground);
}
.ms-select-caret {
  flex-shrink: 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.ms-select-menu {
  display: none;
  position: absolute;
  z-index: 200;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow-y: auto;
  padding: 6px 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.ms-select.open .ms-select-menu {
  display: block;
}
.ms-select-group-title {
  padding: 8px 12px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.ms-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0;
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}
.ms-select-option:hover {
  background: var(--secondary);
}
.ms-select-option input {
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}

/* Chips */
.chip-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: text;
}
.chip-input-wrap:focus-within { box-shadow: 0 0 0 2px var(--ring); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(23,162,184,0.1);
  color: var(--primary);
  border-radius: 6px;
  font-size: 0.8125rem;
}
.chip-remove {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0 2px;
  font-size: 1rem;
  line-height: 1;
}
.chip-remove:hover { color: var(--destructive); }
.chip-input-field {
  border: none;
  outline: none;
  flex: 1;
  min-width: 120px;
  font-size: 0.875rem;
}
.chip-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--secondary);
  color: var(--muted-foreground);
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Sites Info — wide table */
.sites-info-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sites-info-table {
  font-size: 0.8125rem;
  min-width: 1100px;
}
.sites-info-table thead th {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 10px 12px;
}
.sites-info-table tbody td {
  padding: 10px 12px;
  vertical-align: top;
}
.sites-info-table .col-num {
  text-align: right;
  white-space: nowrap;
}
.sites-info-table .col-url {
  max-width: 200px;
}
.sites-info-table .col-schain {
  max-width: 160px;
  white-space: normal;
  word-break: break-word;
}
.sites-info-table .col-networks {
  min-width: 240px;
  max-width: 300px;
  white-space: normal;
}
.sites-info-table .col-sticky.col-code {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
  min-width: 120px;
}
.sites-info-table thead .col-sticky.col-code {
  background: var(--secondary);
  z-index: 3;
}
.sites-info-table tbody tr:nth-child(even) .col-sticky.col-code {
  background: var(--secondary);
}
.sites-info-table tbody tr:hover .col-sticky.col-code {
  background: #e6f7fb;
}
.cell-truncate {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.networks-cell {
  line-height: 1.4;
}
.networks-count {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.networks-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
  max-height: 52px;
  overflow: hidden;
}
.networks-cell.is-expanded .networks-chips {
  max-height: none;
}
.networks-more {
  display: none;
}
.networks-cell.is-expanded .networks-more {
  display: contents;
}
.networks-toggle {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.networks-toggle:hover {
  text-decoration: underline;
}
.btn-link {
  background: none;
  border: none;
  padding: 0;
}

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.scope-note { font-size: 0.75rem; color: var(--muted-foreground); margin: 8px 0 16px; }

/* Tables */
.dataTable_wrapper { overflow-x: auto; }
table.dataTable, table.table-zebra {
  width: 100% !important;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.dataTable thead th,
table.table-zebra thead th {
  background: var(--secondary);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
table.dataTable tbody td,
table.table-zebra tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
table.table-zebra tbody tr:nth-child(even) { background: var(--secondary); }
table.table-zebra tbody tr:hover,
table.dataTable tbody tr:hover { background: #e6f7fb !important; }
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc { color: var(--primary); }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: var(--radius-pill) !important;
  border: none !important;
}
.gist-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
}
.gist-link {
  color: var(--primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.gist-copy-btn {
  flex-shrink: 0;
  padding: 2px 8px;
  min-width: 0;
  line-height: 1.2;
  color: var(--muted-foreground);
  background: var(--secondary);
  border: 1px solid var(--border);
}
.gist-copy-btn:hover {
  color: var(--primary);
  background: #fff;
  transform: none;
  box-shadow: none;
}
.sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  min-width: 56px;
  vertical-align: middle;
}
.spark-bar {
  display: inline-block;
  width: 5px;
  min-height: 2px;
  background: var(--primary);
  border-radius: 1px 1px 0 0;
  opacity: 0.85;
}
.sparkline-loading .spark-loading-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 28px;
}
.analytics-yesterday {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
table.dataTable td.col-analytics,
table.table-zebra td.col-analytics {
  white-space: nowrap;
}

/* Log viewer */
.log-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.log-meta dt { font-weight: 600; color: var(--muted-foreground); }
.log-output {
  background: var(--sidebar-bg);
  color: #e2e8f0;
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  padding: 16px;
  border-radius: var(--radius);
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line-system { color: var(--primary); }
.log-line-time { color: var(--muted-foreground); }
.code-badge {
  display: inline-block;
  padding: 4px 14px;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.code-badge:hover {
  background: #ffc107;
  color: #2d3748;
  text-decoration: none;
}
.log-meta .code-badge {
  /* Override global `a { color: primary }` so code stays visible on the pill */
  color: #856404;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.2s ease;
}
.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); color: var(--warning-foreground); }
.toast-error { background: var(--destructive); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pis2s legend */
.legend-table { font-size: 0.8125rem; margin-bottom: 16px; width: 100%; }
.legend-table td, .legend-table th { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.status-badge {
  display: inline-block;
  min-width: 46px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  font-size: 0.75rem;
}
.status-yes { background-color: var(--success); }
.status-no { background-color: var(--destructive); }
.status-na { background-color: #6c757d; }
.cell-wrap { white-space: normal; word-break: break-word; }
.bidder-code {
  display: inline-block;
  padding: 1px 7px;
  margin: 1px 0;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }

@media (max-width: 768px) {
  .topbar-menu-btn { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 48px;
    height: calc(100vh - 48px);
    transform: translateX(-100%);
  }
  body.sidebar-mobile-open .sidebar { transform: translateX(0); }
  .main-content { padding: 16px; }
}

/* Iframe embed mode (?token=... or ?embed=1) */
body.embed-mode {
  background: var(--background);
  overflow-x: hidden;
}
body.embed-mode .app-shell,
body.embed-mode .app-body {
  min-height: 0;
  height: auto;
}
body.embed-mode .main-content {
  padding: 12px 16px;
  margin-left: 0;
  width: 100%;
  max-width: none;
}
body.embed-mode .toast-container {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 1000;
}
body.embed-mode .ms-select.open .ms-select-menu {
  z-index: 200;
}
body.embed-mode .daterangepicker {
  z-index: 300;
}

/* User Activity timeline */
.user-activity-summary {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.user-activity-summary code {
  font-size: 0.8125rem;
  background: var(--secondary);
  padding: 2px 6px;
  border-radius: 4px;
}
.user-activity-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}
.user-activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
}
.user-activity-event {
  position: relative;
  padding: 12px 0 12px 20px;
  border-bottom: 1px solid var(--border);
}
.user-activity-event:last-child {
  border-bottom: none;
}
.user-activity-event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 8px;
}
.user-activity-event-marker {
  position: absolute;
  left: -21px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}
.user-activity-event-type {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1a202c;
  font-family: ui-monospace, monospace;
}
.user-activity-event-date {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.user-activity-event-details {
  margin-top: 4px;
}
.user-activity-event-details summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--primary);
  font-weight: 500;
  user-select: none;
}
.user-activity-event-details summary:hover {
  text-decoration: underline;
}
.user-activity-json {
  margin: 10px 0 0;
  padding: 12px 14px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.5;
  max-height: 360px;
  overflow-y: auto;
}
.user-activity-json code {
  font-family: ui-monospace, Consolas, monospace;
  white-space: pre;
}
