:root {
  /* Bootstrap's own variables -- every .btn-primary, link, focus ring and card/input radius
     across all pages reads these, so retinting them here restyles the whole app without
     touching page markup. */
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: #2563eb;
  --bs-link-color-rgb: 37, 99, 235;
  --bs-link-hover-color: #1d4ed8;
  --bs-link-hover-color-rgb: 29, 78, 216;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: #1e293b;
  --bs-border-color: #e2e8f0;
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.75rem;
  --bs-border-radius-xl: 1rem;

  /* Custom tokens used by the classes below. */
  --surface: #ffffff;
  --surface-muted: #f4f6fa;
  --surface-sunken: #f8fafc;
  --border-subtle: #e2e8f0;
  --text-strong: #0f172a;
  --text-muted-2: #64748b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.12);
  --sidebar-width: 248px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --sidebar-hover: rgba(148, 163, 184, 0.12);
  --sidebar-active: #1e3a8a;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  margin: 0;
  background-color: var(--surface-muted);
  color: var(--bs-body-color);
  font-family: var(--bs-body-font-family);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .h4, .h5, .h6 {
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --- Shell layout: fixed sidebar + topbar + content --- */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.sidebar-brand-logo {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  overflow: hidden;
  display: inline-flex;
  background-color: #ffffff;
  padding: 0.15rem;
}

.sidebar-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
}

.branding-preview {
  width: 96px;
  height: 96px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--bs-border-radius-lg);
  object-fit: contain;
  background-color: #fff;
  padding: 0.25rem;
}

.branding-preview-wide {
  width: 100%;
  max-width: 320px;
  height: 96px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--bs-border-radius-lg);
  object-fit: cover;
}

.admin-sidebar .nav {
  padding: 0.6rem 0.7rem 1.5rem;
  gap: 0.1rem;
}

.admin-sidebar .nav-section {
  list-style: none;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 1rem 0.8rem 0.35rem;
}

.admin-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--sidebar-text);
  padding: 0.5rem 0.8rem;
  border-radius: var(--bs-border-radius);
  font-weight: 500;
  font-size: 0.9rem;
}

.admin-sidebar .nav-link i {
  font-size: 1.05rem;
  width: 1.2rem;
  text-align: center;
  color: #94a3b8;
}

.admin-sidebar .nav-link:hover {
  color: #ffffff;
  background-color: var(--sidebar-hover);
}

.admin-sidebar .nav-link:hover i {
  color: #e2e8f0;
}

.admin-sidebar .nav-link.active {
  color: #ffffff;
  background-color: var(--sidebar-active);
  font-weight: 600;
}

.admin-sidebar .nav-link.active i {
  color: #93c5fd;
}

.admin-sidebar .nav-link:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}

.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.7rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 3.75rem;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-heading {
  min-width: 0;
}

.topbar-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted-2);
  line-height: 1.2;
}

.topbar-page {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-menu-btn {
  border: 1px solid var(--border-subtle);
  color: var(--text-strong);
  background-color: var(--surface);
}

.topbar-user {
  flex-shrink: 0;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 0;
  background: transparent;
  padding: 0.25rem 0.4rem;
  border-radius: var(--bs-border-radius);
  color: var(--text-strong);
}

.topbar-user-btn:hover,
.topbar-user-btn[aria-expanded="true"] {
  background-color: var(--surface-sunken);
}

.topbar-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background-color: #dbeafe;
  color: #1e3a8a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.topbar-user-text {
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  text-align: left;
}

.topbar-user-name {
  font-weight: 500;
  font-size: 0.875rem;
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted-2);
}

.topbar-caret {
  font-size: 0.75rem;
  color: var(--text-muted-2);
}

.topbar-user-menu {
  min-width: 15rem;
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-md);
  border-radius: var(--bs-border-radius-lg);
  padding: 0.35rem 0;
}

.admin-content {
  padding: 1.75rem;
  flex: 1;
  min-width: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
}

/* --- Tablet and phone: off-canvas sidebar, tighter spacing --- */
@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1045;
    box-shadow: var(--shadow-md);
  }

  .admin-sidebar.show {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1040;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .admin-topbar {
    padding: 0.6rem 1rem;
  }

  .admin-content {
    padding: 1rem;
  }
}

@media (min-width: 992px) {
  #sidebarToggle {
    display: none;
  }
}

/* --- Cards --- */

.card {
  border-color: var(--border-subtle);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  padding: 0.9rem 1.25rem;
}

.card-body {
  padding: 1.25rem;
}

/* Any card that hosts a table scrolls that table sideways on its own when it is wider than
   the card, instead of making the whole page wider than the screen (no page puts a menu
   inside a table, so nothing gets clipped). */
.card-body:has(table),
.card:has(> table),
.card:has(> .table) {
  overflow-x: auto;
}

.dashboard-card {
  display: block;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.dashboard-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--bs-border-radius);
  font-size: 1.2rem;
  margin-bottom: 0.65rem;
}

.stat-icon-blue { background-color: #dbeafe; color: #1d4ed8; }
.stat-icon-green { background-color: #dcfce7; color: #15803d; }
.stat-icon-amber { background-color: #fef3c7; color: #b45309; }
.stat-icon-red { background-color: #fee2e2; color: #b91c1c; }
.stat-icon-purple { background-color: #ede9fe; color: #6d28d9; }
.stat-icon-teal { background-color: #ccfbf1; color: #0f766e; }

/* --- Tables --- */

.table {
  margin-bottom: 0;
}

.table thead th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted-2);
  background-color: var(--surface-sunken);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.1rem;
  white-space: nowrap;
}

.table td {
  padding: 0.8rem 1.1rem;
  vertical-align: middle;
  border-bottom-color: var(--border-subtle);
}

/* List tables keep each value on one line (names, channels, dates) and scroll sideways inside
   their card when they run out of room; a long free-text cell can opt back in with .text-wrap. */
table.sortable td {
  white-space: nowrap;
}

table.sortable td.text-wrap {
  white-space: normal;
}

.card > .table,
.card-body > .table,
.card .table-responsive > .table {
  margin-bottom: 0;
}

.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: rgba(var(--bs-primary-rgb), 0.04);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.06) !important;
}

.row-expiring-soon > * {
  --bs-table-bg-state: #fee2e2;
}

table.sortable th[data-sort] {
  cursor: pointer;
  user-select: none;
}

table.sortable th[data-sort]::after {
  content: "\2195";
  opacity: 0.35;
  margin-left: 0.35rem;
  font-size: 0.8em;
}

/* --- Badges: soft-tint pairs instead of solid fills --- */

.badge {
  border-radius: 999px;
  font-weight: 600;
  padding: 0.35em 0.75em;
  letter-spacing: 0.01em;
  font-size: 0.75em;
}

.badge-severity-critical { background-color: rgba(220, 53, 69, 0.12); color: #b42318; }
.badge-severity-high { background-color: rgba(253, 126, 20, 0.15); color: #b54708; }
.badge-severity-medium { background-color: rgba(255, 193, 7, 0.2); color: #92650a; }
.badge-severity-low { background-color: rgba(108, 117, 125, 0.15); color: #495057; }

.badge-status-active { background-color: rgba(25, 135, 84, 0.12); color: #0f6a3e; }
.badge-status-inactive { background-color: rgba(108, 117, 125, 0.15); color: #495057; }
.badge-status-blocked { background-color: rgba(220, 53, 69, 0.12); color: #b42318; }

.role-badge { text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.04em; }
.role-platformadmin { background-color: rgba(13, 110, 253, 0.12); color: #0a52cc; }
.role-platformofficer { background-color: rgba(245, 158, 11, 0.15); color: #b45309; }
.role-tenantadmin { background-color: rgba(25, 135, 84, 0.12); color: #146c43; }
.role-complianceadmin { background-color: rgba(102, 16, 242, 0.12); color: #59189e; }
.role-tenantcomplianceofficer { background-color: rgba(147, 51, 234, 0.10); color: #7e22ce; }
.role-viewonly { background-color: rgba(108, 117, 125, 0.15); color: #495057; }
.role-custom { background-color: rgba(13, 148, 136, 0.12); color: #0f766e; }

/* --- Add/remove chip editor for list-shaped rule thresholds (RuleEdit.cshtml) --- */
.list-field-chip { display: inline-flex; align-items: center; }
.list-field-remove {
  border: none; background: transparent; padding: 0 0 0 0.4em; margin: 0;
  font-size: 1em; line-height: 1; color: inherit; cursor: pointer; opacity: 0.6;
}
.list-field-remove:hover { opacity: 1; }

/* --- Empty states --- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted-2);
  text-align: center;
}

.empty-state .bi {
  font-size: 2.25rem;
  color: #c8ced9;
  margin-bottom: 0.75rem;
}

.empty-state-title {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 0.15rem;
}

.empty-state-subtext {
  font-size: 0.9rem;
}

/* --- Misc --- */

.masked-secret {
  font-family: monospace;
}

.spinner-inline {
  width: 1rem;
  height: 1rem;
  border-width: 0.15rem;
}

.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background-color: #0f172a;
  background-image: radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.35), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(30, 58, 138, 0.45), transparent 50%);
}

/* Absolutely positioned rather than a CSS background-image: a failed background-image
   URL (no platform login-background configured) leaves nothing painted, which would hide
   the .login-page gradient set above since the two would be the same shorthand property.
   A plain <img> with onerror="this.remove()" (Login.cshtml) falls back to that gradient
   cleanly instead. */
.login-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--bs-border-radius-xl);
  box-shadow: var(--shadow-md);
}

.login-logo {
  position: relative;
  width: 3rem;
  height: 3rem;
  border-radius: var(--bs-border-radius-lg);
  background-color: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

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

/* Login page only: logo + wordmark on one line (Change Password keeps the stacked .login-logo). */
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.login-brand .login-logo {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.login-brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-strong);
}

pre.json-view {
  background-color: #1c2b39;
  color: #d7e3f0;
  padding: 0.75rem;
  border-radius: var(--bs-border-radius);
  font-size: 0.85rem;
  max-height: 320px;
  overflow: auto;
}

.json-key { color: #7fc3ff; }
.json-string { color: #a6e22e; }
.json-number { color: #fd971f; }
.json-bool { color: #f92672; }
.json-null { color: #adb5bd; }

/* Guided "New Custom Rule" wizard (CustomRules/Edit.cshtml + wwwroot/js/rule-wizard.js).
   A row of circles + connecting lines; "active" is the current step, "completed" is a step
   already passed (clickable to jump back), everything else is the muted default. */
.rule-wizard-steps {
  display: flex;
  align-items: center;
}

.rule-wizard-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-muted-2);
}

.rule-wizard-step-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted-2);
}

.rule-wizard-step-label {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.rule-wizard-step.active .rule-wizard-step-circle {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
  color: #fff;
}

.rule-wizard-step.active .rule-wizard-step-label,
.rule-wizard-step.completed .rule-wizard-step-label {
  color: var(--text-strong);
}

.rule-wizard-step.completed .rule-wizard-step-circle {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.rule-wizard-step-line {
  flex: 1 1 auto;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 0.5rem;
  min-width: 1rem;
}

/* --- Forms and buttons --- */

.form-control,
.form-select {
  border-color: #d5dbe5;
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #93b4f5;
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.form-label {
  font-weight: 500;
  font-size: 0.85rem;
  color: #334155;
}

.btn {
  font-weight: 500;
}

.btn-primary {
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: #1d4ed8;
  --bs-btn-hover-border-color: #1d4ed8;
  --bs-btn-active-bg: #1e40af;
  --bs-btn-active-border-color: #1e40af;
}

.btn-outline-primary {
  --bs-btn-color: var(--bs-primary);
  --bs-btn-border-color: #bfd0f7;
  --bs-btn-hover-bg: var(--bs-primary);
  --bs-btn-hover-border-color: var(--bs-primary);
}

.alert {
  border-radius: var(--bs-border-radius-lg);
}

/* --- List filter bars: a light panel above the results --- */

.admin-content form[method="get"].row {
  background-color: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-sm);
  margin-left: 0;
  margin-right: 0;
  padding: 0.75rem 0.5rem;
  --bs-gutter-y: 0.5rem;
}

.filter-toggle {
  display: none;
}

@media (max-width: 767.98px) {
  .filter-toggle {
    display: block;
  }

  /* !important: some filter columns carry Bootstrap's d-flex, which is itself !important. */
  form.filters-collapsible:not(.filters-open) .filter-extra {
    display: none !important;
  }
}

/* --- Stacked tables on phones (<table class="table-stack">, labels set by site.js) --- */

@media (max-width: 575.98px) {
  table.table-stack thead {
    display: none;
  }

  table.table-stack,
  table.table-stack tbody,
  table.table-stack tr,
  table.table-stack td {
    display: block;
    width: 100%;
  }

  table.table-stack tr {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
  }

  table.table-stack td {
    padding: 0.2rem 0;
    border: 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  table.table-stack td[data-label]::before {
    content: attr(data-label);
    float: left;
    margin-right: 1rem;
    color: var(--text-muted-2);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.9;
  }
}

/* --- Phone tweaks --- */

@media (max-width: 575.98px) {
  .topbar-page {
    font-size: 1rem;
  }

  .card-header {
    padding: 0.75rem 1rem;
  }

  .card-body {
    padding: 1rem;
  }
}

/* --- Wrapping: button rows and inline search forms wrap onto a second line instead of
   pushing the page wider than the screen; pagers wrap too. --- */

.admin-content .d-flex.gap-1,
.admin-content .d-flex.gap-2,
.admin-content .d-flex.gap-3 {
  flex-wrap: wrap;
}

.pagination {
  flex-wrap: wrap;
  gap: 0.25rem;
}

.pagination .page-link {
  border-radius: var(--bs-border-radius-sm) !important;
  border-color: var(--border-subtle);
  min-width: 2.25rem;
  text-align: center;
}

/* Dashboard tiles sit two to a row on phones: tighter padding and a smaller icon. */
@media (max-width: 575.98px) {
  .dashboard-card .card-body {
    padding: 0.85rem;
  }

  .dashboard-card .stat-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
    margin-bottom: 0.45rem;
  }
}

/* --- Investigation workspace (/network/investigations/{id}) --- */

.inv-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.inv-title {
  flex: 1 1 260px;
  min-width: 0;
}

.inv-title .font-monospace {
  word-break: break-all;
}

.inv-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.inv-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--bs-border-radius);
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-sm);
}

.inv-field {
  display: flex;
  flex-direction: column;
  min-width: 8.5rem;
}

.inv-field-label {
  font-size: 0.75rem;
  color: var(--text-muted-2);
  margin-bottom: 0.15rem;
}

.inv-filter-btn {
  min-width: 4.5rem;
}

.inv-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.inv-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(300px, 400px);
  gap: 1rem;
  align-items: stretch;
}

.inv-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - 230px);
  min-height: 620px;
}

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

.inv-panel-foot {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
}

.min-w-0 {
  min-width: 0;
}

/* Node list */
.inv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.inv-pill {
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-muted-2);
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 0.15rem 0.6rem;
}

.inv-pill.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
}

.inv-node-list {
  flex: 1 1 auto;
  overflow-y: auto;
  border-top: 1px solid var(--border-subtle);
}

.inv-node-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 3px solid transparent;
  padding: 0.6rem 0.85rem;
}

.inv-node-row:hover {
  background: var(--surface-sunken);
}

.inv-node-row.active {
  background: #eff6ff;
  border-left-color: #2563eb;
}

/* Taken off the graph by the date range; still listed so it can be found. */
.inv-node-row.inv-node-out {
  opacity: 0.55;
}

.inv-node-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.inv-node-name {
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-node-type {
  font-size: 0.8rem;
  color: var(--text-muted-2);
}

/* Node shapes (list, legend, tables) */
.inv-shape {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-right: 0.35rem;
  vertical-align: -2px;
}

.inv-node-row .inv-shape {
  width: 18px;
  height: 18px;
  margin-right: 0;
}

.inv-shape-customer { border-radius: 50%; background: #2563eb; }
.inv-shape-external { border-radius: 50%; background: #64748b; }
.inv-shape-agent { border-radius: 3px; background: #f97316; }
.inv-shape-case { background: #dc2626; transform: rotate(45deg) scale(0.82); }
.inv-shape-blocked { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #991b1b; }
.inv-shape-glow { box-shadow: 0 0 6px 3px rgba(245, 158, 11, 0.85); }

/* Risk badges */
.inv-risk {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 0.375rem;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

.inv-risk-low { background: #dcfce7; color: #166534; }
.inv-risk-medium { background: #dbeafe; color: #1d4ed8; }
.inv-risk-high { background: #fee2e2; color: #b91c1c; }
.inv-risk-top { background: #dc2626; color: #fff; }

/* Graph */
.inv-graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.inv-legend-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.inv-volume-key {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--bs-border-radius-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
}

.inv-volume {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted-2);
  white-space: nowrap;
}

.inv-volume-line {
  display: inline-block;
  width: 22px;
  background: #475569;
  border-radius: 2px;
}

.inv-legend-menu {
  min-width: 300px;
}

.inv-legend-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.inv-line {
  display: inline-block;
  width: 26px;
  flex-shrink: 0;
  margin-right: 0.35rem;
  border-top: 2px solid #475569;
}

.inv-line-dotted { border-top: 2px dotted #14b8a6; }
.inv-line-dashed { border-top: 2px dashed #8b5cf6; }

.inv-graph-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.inv-graph-canvas {
  position: absolute;
  inset: 0;
}

.inv-exit-fullscreen {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.inv-zoom {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.inv-zoom .btn {
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
  width: 2.4rem;
  height: 2.4rem;
}

.inv-zoom .btn:last-child {
  border-bottom: 0;
}

.inv-minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--shadow-sm);
  padding: 4px;
}

.inv-minimap canvas {
  display: block;
  width: 200px;
  height: 130px;
  cursor: pointer;
}

.inv-minimap.collapsed canvas {
  display: none;
}

.inv-minimap-toggle {
  position: absolute;
  right: -1px;
  top: -1px;
  transform: translateY(-100%);
  padding: 0 0.4rem;
  border: 1px solid var(--border-subtle);
  line-height: 1.4;
}

.inv-minimap.collapsed .inv-minimap-toggle {
  position: static;
  transform: none;
  border: 0;
}

#graphCard.graph-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1050;
  height: auto;
  border-radius: 0;
  margin: 0;
}

/* Inspector */
.inv-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: #eff6ff;
  color: #1d4ed8;
}

.inv-chip .inv-shape {
  width: 10px;
  height: 10px;
}

.inv-chip-risk.inv-risk-medium { background: #fef3c7; color: #92400e; }

.inv-tabs {
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.7rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.inv-tabs::-webkit-scrollbar {
  display: none;
}

.inv-tabs .nav-link {
  font-size: 0.8rem;
  white-space: nowrap;
  padding: 0.45rem 0;
}

.inv-inspector-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 1rem;
}

.inv-dl {
  display: grid;
  grid-template-columns: minmax(90px, 38%) minmax(0, 1fr);
  gap: 0.4rem 0.75rem;
  font-size: 0.86rem;
  margin-bottom: 0.75rem;
}

.inv-dl dt {
  font-weight: 400;
  color: var(--text-muted-2);
}

.inv-dl dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.inv-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.inv-table {
  font-size: 0.8rem;
  table-layout: fixed;
  width: 100%;
}

/* The site-wide list-table padding (1.1rem a side) is far too wide for the inspector's narrow tables. */
.table.inv-table thead th,
.table.inv-table td {
  padding: 0.35rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table.inv-table thead th {
  font-size: 0.66rem;
}

.inv-table th {
  font-weight: 600;
  color: var(--text-muted-2);
  background: var(--surface-sunken);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-cell-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-clickable {
  cursor: pointer;
}

.inv-clickable:hover td {
  background: var(--surface-sunken);
}

/* Narrower desktops: slimmer side panels. Tablets and phones: list, graph, inspector stacked. */
@media (max-width: 1399.98px) {
  .inv-workspace {
    grid-template-columns: minmax(230px, 260px) minmax(0, 1fr) minmax(280px, 340px);
  }
}

@media (max-width: 1199.98px) {
  .inv-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .inv-panel {
    height: auto;
    min-height: 0;
  }

  .inv-nodes .inv-node-list {
    max-height: 320px;
  }

  .inv-graph-card {
    height: 70vh;
    min-height: 460px;
  }

  .inv-header-actions {
    margin-left: 0;
  }
}

@media (max-width: 575.98px) {
  .inv-filters {
    width: 100%;
  }

  .inv-field {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
  }

  .inv-minimap,
  .inv-volume-key {
    display: none;
  }
}
