/*
  FBM DLP Console theme
  Loaded after bootstrap.min.css / site.css — overrides + additions only.
  Compact, cool-light admin theme built on CSS custom properties.
*/

:root {
  --dlp-primary: #3457d5;
  --dlp-primary-dark: #2941ab;
  --dlp-primary-light: #eaf0fe;
  --dlp-accent: #14b8a6;
  --dlp-bg: #f2f5fb;
  --dlp-surface: #ffffff;
  --dlp-surface-muted: #f8fafc;
  --dlp-border: #e2e8f0;
  --dlp-text: #1e293b;
  --dlp-text-muted: #64748b;
  --dlp-text-faint: #94a3b8;
  --dlp-success: #16a34a;
  --dlp-success-bg: #ecfdf5;
  --dlp-warning: #d97706;
  --dlp-warning-bg: #fffbeb;
  --dlp-danger: #dc2626;
  --dlp-danger-bg: #fef2f2;
  --dlp-muted: #64748b;
  --dlp-muted-bg: #f1f5f9;

  --dlp-radius-sm: 0.375rem;
  --dlp-radius-md: 0.5rem;
  --dlp-radius-lg: 0.75rem;
  --dlp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --dlp-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);

  --dlp-topbar-height: 3.25rem;
  --dlp-sidebar-width: 15rem;

  --dlp-font-size: 0.85rem;
}

/* ---------- Compact base ---------- */

html,
body {
  font-size: var(--dlp-font-size);
  background-color: var(--dlp-bg);
  color: var(--dlp-text);
}

body {
  margin-bottom: 0;
}

a {
  color: var(--dlp-primary);
}

a:hover {
  color: var(--dlp-primary-dark);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--dlp-text);
  font-weight: 600;
}

/* ---------- App shell: top bar + side nav ---------- */

.app-topbar {
  height: var(--dlp-topbar-height);
  background-color: var(--dlp-surface);
  border-bottom: 1px solid var(--dlp-border);
  box-shadow: var(--dlp-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
}

.app-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--dlp-text);
  text-decoration: none;
  width: var(--dlp-sidebar-width);
}

.app-topbar-brand .brand-mark {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  border-radius: var(--dlp-radius-sm);
  object-fit: contain;
}

.app-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.app-topbar-user .user-role-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dlp-primary);
  background-color: var(--dlp-primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.app-topbar-user .org-badge {
  font-size: 0.78rem;
  color: var(--dlp-text-muted);
  padding-right: 0.5rem;
  border-right: 1px solid var(--dlp-border);
}

.app-sidebar {
  position: fixed;
  top: var(--dlp-topbar-height);
  bottom: 0;
  left: 0;
  width: var(--dlp-sidebar-width);
  background-color: var(--dlp-surface);
  border-right: 1px solid var(--dlp-border);
  padding: 1rem 0.75rem;
  overflow-y: auto;
  z-index: 1020;
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-sidebar-category {
  display: flex;
  flex-direction: column;
}

.app-sidebar-category-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: var(--dlp-radius-sm);
  background-color: transparent;
  color: var(--dlp-text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar-category-toggle:hover {
  background-color: var(--dlp-surface-muted);
  color: var(--dlp-text);
}

.app-sidebar-category-toggle:focus-visible {
  outline: 2px solid var(--dlp-primary);
  outline-offset: 2px;
}

.app-sidebar-category-toggle .nav-icon {
  display: inline-flex;
  width: 1.1rem;
  flex-shrink: 0;
  justify-content: center;
}

.app-sidebar-category-label {
  flex: 1;
}

.app-sidebar-category-chevron {
  display: inline-flex;
  color: var(--dlp-text-faint);
  transition: transform 0.2s ease;
}

.app-sidebar-category.is-open .app-sidebar-category-chevron {
  transform: rotate(90deg);
}

.app-sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  visibility: hidden;
  transition: max-height 0.25s ease, visibility 0s linear 0.25s;
}

.app-sidebar-category.is-open .app-sidebar-submenu {
  max-height: 100rem;
  visibility: visible;
  transition-delay: 0s;
}

.app-sidebar-submenu .nav-link {
  padding-left: 1.55rem;
}

.app-sidebar-submenu .nav-link + .nav-link {
  margin-top: 0.15rem;
}

.app-sidebar-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dlp-text-faint);
  font-weight: 700;
  padding: 0.75rem 0.6rem 0.3rem;
}

.app-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--dlp-radius-sm);
  color: var(--dlp-text-muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.app-sidebar .nav-link .nav-icon {
  display: inline-flex;
  width: 1.1rem;
  justify-content: center;
}

.app-sidebar .nav-link:hover {
  background-color: var(--dlp-surface-muted);
  color: var(--dlp-text);
}

.app-sidebar .nav-link.active {
  background-color: var(--dlp-primary-light);
  color: var(--dlp-primary-dark);
  font-weight: 600;
}

.app-main {
  margin-left: var(--dlp-sidebar-width);
  padding-top: calc(var(--dlp-topbar-height) + 1.25rem);
  padding-bottom: 2rem;
  min-height: 100vh;
}

.page-container {
  width: 100%;
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.page-subtitle {
  color: var(--dlp-text-muted);
  font-size: 0.82rem;
  margin-bottom: 0;
}

/* ---------- Cards / surfaces ---------- */

.content-card {
  background-color: var(--dlp-surface);
  border: 1px solid var(--dlp-border);
  border-radius: var(--dlp-radius-lg);
  box-shadow: var(--dlp-shadow-sm);
  padding: 1.25rem;
}

.content-card + .content-card {
  margin-top: 1rem;
}

/* ---------- Toolbar (search + page size + actions) ---------- */

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.list-toolbar-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
}

.search-box input {
  padding-left: 2.1rem;
  min-width: 15rem;
}

.search-box .search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dlp-text-faint);
  pointer-events: none;
}

.page-size-select {
  width: auto;
}

/* ---------- Forms ---------- */

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dlp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.3rem;
}

.form-control,
.form-select {
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--dlp-radius-sm);
  border-color: var(--dlp-border);
  background-color: var(--dlp-surface);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--dlp-primary);
  box-shadow: 0 0 0 0.2rem var(--dlp-primary-light);
}

.form-text {
  font-size: 0.75rem;
  color: var(--dlp-text-faint);
}

.form-check-input:checked {
  background-color: var(--dlp-primary);
  border-color: var(--dlp-primary);
}

.invalid-feedback {
  font-size: 0.75rem;
}

.field-group {
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--dlp-border);
}

/* ---------- Buttons ---------- */

.btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--dlp-radius-sm);
  font-weight: 600;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
}

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

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--dlp-primary-dark);
  border-color: var(--dlp-primary-dark);
}

.btn-outline-secondary {
  color: var(--dlp-text-muted);
  border-color: var(--dlp-border);
}

.btn-outline-secondary:hover {
  background-color: var(--dlp-surface-muted);
  color: var(--dlp-text);
  border-color: var(--dlp-border);
}

/* ---------- Table ---------- */

.table {
  font-size: 0.82rem;
  margin-bottom: 0;
}

.table > thead > tr > th {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--dlp-text-faint);
  font-weight: 700;
  border-bottom: 1px solid var(--dlp-border);
  padding: 0.6rem 0.75rem;
  background-color: var(--dlp-surface-muted);
}

.table > tbody > tr > td {
  padding: 0.55rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--dlp-border);
  color: var(--dlp-text);
}

.table > tbody > tr:last-child > td {
  border-bottom: none;
}

.table > tbody > tr:hover {
  background-color: var(--dlp-surface-muted);
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* ---------- Badges ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.status-badge::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background-color: currentColor;
}

.status-badge.is-active {
  color: var(--dlp-success);
  background-color: var(--dlp-success-bg);
}

.status-badge.is-inactive {
  color: var(--dlp-danger);
  background-color: var(--dlp-danger-bg);
}

.status-badge.is-warning {
  color: var(--dlp-warning);
  background-color: var(--dlp-warning-bg);
}

.status-badge.is-muted {
  color: var(--dlp-muted);
  background-color: var(--dlp-muted-bg);
}

.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: var(--dlp-primary-dark);
  background-color: var(--dlp-primary-light);
}

/* ---------- Pagination ---------- */

.pagination {
  margin-bottom: 0;
  gap: 0.2rem;
}

.page-link {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--dlp-radius-sm);
  border-color: var(--dlp-border);
  color: var(--dlp-text-muted);
}

.page-item.active .page-link {
  background-color: var(--dlp-primary);
  border-color: var(--dlp-primary);
  color: #fff;
}

.pagination-summary {
  color: var(--dlp-text-muted);
  font-size: 0.78rem;
}

/* ---------- Stat tiles (dashboard) ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-tile {
  background-color: var(--dlp-surface);
  border: 1px solid var(--dlp-border);
  border-radius: var(--dlp-radius-lg);
  box-shadow: var(--dlp-shadow-sm);
  padding: 1rem 1.1rem;
  border-top: 3px solid var(--dlp-border);
}

a.stat-tile {
  display: block;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

a.stat-tile:hover {
  box-shadow: var(--dlp-shadow-md);
  transform: translateY(-1px);
}

.stat-tile.is-accent-primary {
  border-top-color: var(--dlp-primary);
}

.stat-tile.is-accent-success {
  border-top-color: var(--dlp-success);
}

.stat-tile.is-accent-warning {
  border-top-color: var(--dlp-warning);
}

.stat-tile.is-accent-danger {
  border-top-color: var(--dlp-danger);
}

.stat-tile-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dlp-text-faint);
  margin-bottom: 0.4rem;
}

.stat-tile-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dlp-text);
  line-height: 1.1;
}

.stat-tile-hint {
  font-size: 0.75rem;
  color: var(--dlp-text-muted);
  margin-top: 0.2rem;
}

/* ---------- Detail rows ---------- */

.detail-row {
  display: flex;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--dlp-border);
}

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

.detail-label {
  width: 11rem;
  flex-shrink: 0;
  color: var(--dlp-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.detail-value {
  color: var(--dlp-text);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--dlp-text-muted);
}

/* ---------- Alerts ---------- */

.alert {
  font-size: 0.82rem;
  border-radius: var(--dlp-radius-md);
}

/* ---------- Global loading indicator ---------- */

.global-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(242, 245, 251, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.global-loading-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.global-loading-overlay .global-loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 0.25rem solid var(--dlp-primary-light);
  border-top-color: var(--dlp-primary);
  animation: dlp-spin 0.7s linear infinite;
}

.btn-spinner {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  border: 0.15rem solid rgba(255, 255, 255, 0.5);
  border-top-color: currentColor;
  vertical-align: -0.15rem;
  animation: dlp-spin 0.6s linear infinite;
}

.btn-outline-secondary .btn-spinner,
.btn-outline-secondary.is-loading {
  border-color: rgba(100, 116, 139, 0.3);
}

.btn.is-loading {
  cursor: progress;
}

@keyframes dlp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Login page ---------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #e7edfe 0%, var(--dlp-bg) 45%),
    linear-gradient(160deg, var(--dlp-bg) 0%, #eef2fb 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 24rem;
  background-color: var(--dlp-surface);
  border: 1px solid var(--dlp-border);
  border-radius: var(--dlp-radius-lg);
  box-shadow: var(--dlp-shadow-md);
  padding: 2rem 1.75rem;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.5rem;
}

    .login-brand .brand-mark {
        width: 6.75rem;
        height: 6.75rem;
        border-radius: var(--dlp-radius-md);
        object-fit: contain;
        margin-bottom: 0.75rem;
    }

.login-brand h1 {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}

.login-brand p {
  color: var(--dlp-text-muted);
  font-size: 0.8rem;
  margin-bottom: 0;
}

.login-card .btn-primary {
  width: 100%;
  padding: 0.55rem 0.9rem;
  margin-top: 0.5rem;
}

.login-footnote {
  text-align: center;
  color: var(--dlp-text-faint);
  font-size: 0.72rem;
  margin-top: 1.25rem;
}

/* ---------- Responsive ---------- */

/* ---------- Trend chart (inline SVG, see Charting/InlineSvgChart.cs) ---------- */

.trend-chart {
  width: 100%;
  height: auto;
  max-height: 160px;
}

.trend-chart-area {
  fill: var(--dlp-primary-light);
  stroke: none;
}

.trend-chart-line {
  stroke: var(--dlp-primary);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-chart-point {
  fill: var(--dlp-primary);
}

.trend-chart-label {
  font-size: 0.6rem;
  fill: var(--dlp-text-faint);
}

/* ---------- Top-N breakdown bar lists ---------- */

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar-list-item {
  display: grid;
  grid-template-columns: 8rem 1fr 2.25rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.bar-list-label {
  color: var(--dlp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-list-track {
  background-color: var(--dlp-surface-muted);
  border-radius: 999px;
  height: 0.55rem;
  overflow: hidden;
}

.bar-list-fill {
  background-color: var(--dlp-primary);
  height: 100%;
  border-radius: 999px;
}

.bar-list-count {
  text-align: right;
  color: var(--dlp-text-muted);
  font-weight: 600;
}

/* ---------- Attention-needed incident list ---------- */

.attention-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--dlp-border);
  border-radius: var(--dlp-radius-md);
  background-color: var(--dlp-surface);
}

.attention-item-title {
  font-weight: 600;
  color: var(--dlp-text);
  font-size: 0.85rem;
}

.attention-item-meta {
  color: var(--dlp-text-muted);
  font-size: 0.75rem;
}

/* ---------- Process tree ---------- */

.process-tree,
.process-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 1.1rem;
}

.process-tree {
  padding-left: 0;
}

.process-tree li {
  position: relative;
  padding: 0.15rem 0 0.15rem 0.5rem;
  border-left: 1px dashed var(--dlp-border);
}

.process-tree > li {
  border-left: none;
  padding-left: 0;
}

.process-node {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.process-node-name {
  font-weight: 600;
  color: var(--dlp-text);
}

.process-node-pid {
  color: var(--dlp-text-faint);
  font-size: 0.72rem;
}

.process-node-elevated {
  color: var(--dlp-warning);
  font-size: 0.7rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .app-sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--dlp-shadow-md);
  }

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

  .app-topbar-brand {
    width: auto;
  }
}
