/* rs_server/server/static/dashboard/dashboard.css */
/* RedSwarm Brain Design System — dark maroon theme with red primary accent */

/* ===================================================================
   1. DESIGN TOKENS
   =================================================================== */
:root {
  /* --- Brand Colors --- */
  --rs-primary: #d93636;
  --rs-primary-dark: #b82e2e;
  --rs-primary-rgb: 217, 54, 54;

  /* --- Semantic Colors (status / severity) --- */
  --rs-success: #1cc88a;
  --rs-info: #36b9cc;
  --rs-warning: #f6c23e;
  --rs-danger: #e74a3b;
  --rs-secondary: #858796;

  /* --- Surface / Background --- */
  --rs-bg-dark: #2c1810;
  --rs-bg-gradient: linear-gradient(
    135deg,
    #3d2018 0%,
    #2c1810 50%,
    #1a0f0c 100%
  );
  --rs-form-bg: #f5f5f5;
  --rs-code-bg: #f8f9fa;
  --rs-surface: #ffffff;

  /* --- Text --- */
  --rs-text-dark: #1f2937;
  --rs-text-muted: #858796;
  --rs-text-light: #d1d5db;

  /* --- Typography --- */
  --rs-font-size-xs: 0.7rem;
  --rs-font-size-sm: 0.85rem;
  --rs-font-size-base: 0.95rem;
  --rs-font-size-lg: 1.1rem;

  /* --- Spacing --- */
  --rs-border-left-width: 0.25rem;
  --rs-card-gap: 1.5rem;

  /* --- Z-index layers --- */
  --rs-z-sidebar: 1040;
  --rs-z-backdrop: 1030;
  --rs-z-mobile-header: 1050;

  /* --- Transitions --- */
  --rs-transition-fast: 0.2s ease;
  --rs-transition-base: 0.25s ease-out;

  /* --- Scrollable container max-heights --- */
  --rs-scroll-sm: 300px;
  --rs-scroll-md: 400px;
  --rs-scroll-lg: 600px;

  /* Chart.js: RGB triplets for rgb() usage */
  --rs-chart-line: 217, 54, 54;
  --rs-chart-detected: 217, 54, 54;
  --rs-chart-neutral: 108, 117, 125;
}

/* ===================================================================
   2. BOOTSTRAP OVERRIDES (primary brand color)
   =================================================================== */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--rs-primary);
  border-color: var(--rs-primary);
}
.btn-primary:hover {
  background-color: var(--rs-primary-dark);
  border-color: var(--rs-primary-dark);
}
.btn-primary:focus {
  box-shadow: 0 0 0 0.25rem rgba(var(--rs-primary-rgb), 0.5);
}
.btn-primary:active {
  background-color: #a52828;
  border-color: #a52828;
}
.text-primary {
  color: var(--rs-primary) !important;
}
.border-primary {
  border-color: var(--rs-primary) !important;
}
a.text-primary:hover,
a.text-primary:focus {
  color: var(--rs-primary-dark) !important;
}

body {
  font-size: var(--rs-font-size-base);
}

html {
  scroll-padding-bottom: 2.5rem;
}

/* ===================================================================
   3. MOBILE HEADER
   =================================================================== */
.dashboard-mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--rs-z-mobile-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--rs-bg-gradient);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.dashboard-mobile-header-brand {
  color: #fff;
  font-weight: 600;
  font-size: var(--rs-font-size-lg);
}

/* ===================================================================
   4. SIDEBAR BACKDROP
   =================================================================== */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--rs-z-backdrop);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--rs-transition-fast),
    visibility var(--rs-transition-fast);
}
body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  visibility: visible;
}

/* ===================================================================
   5. SIDEBAR
   =================================================================== */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: var(--rs-z-sidebar);
  padding: 0;
  width: 240px;
  background: var(--rs-bg-gradient);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.2);
  transition: transform var(--rs-transition-base);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}
@media (max-width: 767.98px) {
  .sidebar {
    top: 0;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    display: block;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .dashboard-main {
    margin-left: 0;
    padding-top: 3.5rem;
  }
  /* Improve readability of stat card labels on small screens */
  .stat-card-icon {
    font-size: 1.5rem;
  }
  /* Prevent long code/pattern strings from breaking layout */
  .list-group-item code,
  td code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-all;
  }
  /* Stack action buttons vertically on narrow screens */
  .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* Thin scrollbar for sidebar (dark theme) */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
/* Firefox thin scrollbar */
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.sidebar > div {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.75rem 1rem;
}
.sidebar .nav-link:hover {
  color: #fff;
  background-color: rgba(var(--rs-primary-rgb), 0.25);
}
.sidebar .nav-link.active {
  color: #fff;
  background-color: var(--rs-primary);
}
.sidebar .nav-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: -2px;
}
.sidebar .nav-link i {
  margin-right: 0.5rem;
}
.sidebar .sidebar-group-label {
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}
.sidebar .sidebar-group-label:first-child {
  padding-top: 0;
  margin-top: 0;
}

.sidebar-user-section {
  margin-top: auto;
}
.sidebar-user-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0.75rem;
}
.sidebar-user-name {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .sidebar-user-section .nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 1rem;
}
.sidebar .sidebar-user-section .nav-link.text-danger:hover {
  background: rgba(217, 54, 54, 0.15);
  color: #ff6b6b !important;
}

/* ===================================================================
   6. MAIN CONTENT AREA
   =================================================================== */
body {
  overflow-x: hidden;
  background-color: #eef0f4;
}

/* Global card surface contrast — white card on #eef0f4 bg */
.card,
.rs-card,
.rs-inv-card,
.rs-ops-card {
  border: 1px solid #d8dce4 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.09) !important;
}

/* Table container: strengthen row dividers */
.table > :not(caption) > * > * {
  border-color: #cdd1d9;
}
.table thead th {
  border-bottom-color: #c2c7d2 !important;
}

.dashboard-main {
  margin-left: 0;
  padding: 0 1rem 4rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.rs-copyright-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  font-size: 0.75rem;
  color: #858796;
  z-index: 900;
}
@media (min-width: 768px) {
  .dashboard-main {
    margin-left: 240px;
    padding: 0 1.5rem 4rem;
    width: calc(100% - 240px);
  }
}

/* ===================================================================
   7. CARDS & STAT CARD BORDERS
   =================================================================== */
.card {
  margin-bottom: var(--rs-card-gap);
}

.border-left-primary {
  border-left: var(--rs-border-left-width) solid var(--rs-primary) !important;
}
.border-left-success {
  border-left: var(--rs-border-left-width) solid var(--rs-success) !important;
}
.border-left-info {
  border-left: var(--rs-border-left-width) solid var(--rs-info) !important;
}
.border-left-warning {
  border-left: var(--rs-border-left-width) solid var(--rs-warning) !important;
}
.border-left-danger {
  border-left: var(--rs-border-left-width) solid var(--rs-danger) !important;
}
.border-left-secondary {
  border-left: var(--rs-border-left-width) solid var(--rs-secondary) !important;
}

/* Stat card icon sizing (replacing SB Admin's fa-2x) */
.stat-card-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--rs-text-light);
}

/* Clickable stat card hover lift */
a:hover > .card[style*="cursor:pointer"] {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ===================================================================
   8. UTILITY CLASSES
   =================================================================== */
.text-xs {
  font-size: var(--rs-font-size-xs);
}
.text-gray-800 {
  color: var(--rs-text-dark);
}
.text-gray-300 {
  color: var(--rs-text-light);
}
.font-weight-bold {
  font-weight: 700;
}

/* Scrollable containers (replaces inline style="max-height: Xpx; overflow-y: auto") */
.rs-scroll-sm {
  max-height: var(--rs-scroll-sm);
  overflow: auto;
}
.rs-scroll-md {
  max-height: var(--rs-scroll-md);
  overflow: auto;
}
.rs-scroll-lg {
  max-height: var(--rs-scroll-lg);
  overflow: auto;
}

/* ===================================================================
   9. COMPONENT DEFAULTS
   =================================================================== */
.badge {
  font-size: var(--rs-font-size-sm);
}
.badge-critical {
  background-color: #85182a;
}

/* Access Control Matrix gap highlighting */
.acm-gap-critical {
  background-color: rgba(220, 53, 69, 0.15) !important;
}
.acm-gap-warning {
  background-color: rgba(255, 193, 7, 0.12) !important;
}
.acm-gap-critical td:first-child::before {
  content: "\26A0\FE0F ";
}

/* ACM Role filter toggle — distinct colors per role with higher contrast on hover */
.acm-role-toggle {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.acm-role-toggle:nth-child(6n+1) { --_role-hue: 210; }
.acm-role-toggle:nth-child(6n+2) { --_role-hue: 150; }
.acm-role-toggle:nth-child(6n+3) { --_role-hue: 30;  }
.acm-role-toggle:nth-child(6n+4) { --_role-hue: 270; }
.acm-role-toggle:nth-child(6n+5) { --_role-hue: 0;   }
.acm-role-toggle:nth-child(6n+6) { --_role-hue: 180; }
.acm-role-toggle.active {
  background-color: hsl(var(--_role-hue, 210) 55% 45%);
  border-color: hsl(var(--_role-hue, 210) 55% 45%);
  color: #fff;
}
.acm-role-toggle:hover {
  background-color: hsl(var(--_role-hue, 210) 65% 35%);
  border-color: hsl(var(--_role-hue, 210) 65% 35%);
  color: #fff;
}
.acm-role-toggle:not(.active) {
  background-color: transparent;
  border-color: hsl(var(--_role-hue, 210) 40% 60%);
  color: hsl(var(--_role-hue, 210) 40% 50%);
}
.acm-role-toggle:not(.active):hover {
  background-color: hsl(var(--_role-hue, 210) 50% 92%);
  border-color: hsl(var(--_role-hue, 210) 50% 45%);
  color: hsl(var(--_role-hue, 210) 50% 30%);
}

/* ACM table: URL column left-aligned, compact badges */
#acmTable td code {
  font-size: var(--rs-font-size-sm);
  word-break: break-all;
}
#acmTable .badge {
  font-size: var(--rs-font-size-xs);
  padding: 0.2em 0.45em;
}

/* Visited URLs table: URL column left-aligned with break */
.table td.text-break code {
  font-size: var(--rs-font-size-sm);
  word-break: break-all;
}

/* Collapse chevron rotation */
[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
  transition: transform 0.2s ease;
}
[data-bs-toggle="collapse"] .bi-chevron-down {
  transition: transform 0.2s ease;
}

code {
  font-size: 0.9em;
  background-color: var(--rs-code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  overflow-wrap: break-word;
  word-break: break-word;
}
pre code {
  background-color: inherit;
  color: inherit;
  padding: 0;
  border-radius: 0;
}
pre {
  overflow-x: auto;
  max-width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ===================================================================
   10. LOGIN PAGE
   =================================================================== */
.login-body {
  background: var(--rs-bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.login-card-header {
  background: var(--rs-primary);
  color: white;
  text-align: center;
  padding: 1.75rem 1.5rem;
}
.login-card-header i {
  font-size: 2.5rem;
  opacity: 0.95;
}
.login-card-header h3 {
  margin: 0.5rem 0 0.25rem;
  font-weight: 600;
  font-size: 1.35rem;
}
.login-card-header p {
  margin: 0;
  font-size: var(--rs-font-size-base);
  opacity: 0.95;
}
.login-card-body {
  background: var(--rs-form-bg);
  padding: 1.75rem 1.5rem;
}
.login-card-body .form-label {
  font-weight: 600;
  color: #333;
}
.btn-login {
  width: 100%;
  padding: 0.75rem;
  font-weight: 500;
  background-color: var(--rs-primary);
  border-color: var(--rs-primary);
}
.btn-login:hover {
  background-color: var(--rs-primary-dark);
  border-color: var(--rs-primary-dark);
}

/* ===================================================================
   11. BULK ACTIONS TOOLBAR
   =================================================================== */
.bulk-actions-toolbar {
  display: none;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  border-bottom: 2px solid var(--rs-primary);
  animation: slideDown 0.2s ease-out;
}
.bulk-actions-toolbar.is-visible {
  display: block;
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Row checkboxes */
.table .form-check-input {
  width: 1.15em;
  height: 1.15em;
  cursor: pointer;
}
.table .form-check-input:checked {
  background-color: var(--rs-primary);
  border-color: var(--rs-primary);
}
.table tbody tr {
  transition: background-color 0.15s ease;
}
.table tr:has(.form-check-input:checked) {
  background-color: rgba(133, 24, 42, 0.04);
}

/* Toast notifications */
.toast-container .toast {
  min-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
}

/* Confirm-delete modal */
#confirmDeleteModal .modal-content {
  border-top: 3px solid var(--bs-danger);
  border-radius: 0.75rem;
}
#confirmDeleteModal .modal-body {
  font-size: 0.95rem;
  line-height: 1.6;
}
#confirmDeleteModal .modal-body ul {
  list-style: disc;
  padding-left: 1.5rem;
  font-size: 0.9rem;
  color: var(--bs-secondary);
}

/* API Key reveal modal — smooth entrance */
#apiKeyModal .modal-dialog {
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
}
#apiKeyModal.modal.fade .modal-dialog {
  transform: scale(0.85) translateY(20px);
  opacity: 0;
}
#apiKeyModal.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}
#apiKeyModal .modal-content {
  border-top: 3px solid var(--rs-primary);
  border-radius: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* ===================================================================
   12. CHART CONTAINERS
   =================================================================== */
.chart-pie {
  min-height: 200px;
}
canvas {
  max-width: 100%;
}

/* ===================================================================
   12b. PAGINATION — unified brand-color style (« < 1 2 3 … N > »)
   =================================================================== */
.rs-pagination .page-link {
  color: #6c757d;
  background-color: #fff;
  border: 1px solid #dee2e6;
  padding: 0.375rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  min-width: 2.2rem;
  text-align: center;
  transition:
    color 0.15s ease-in-out,
    background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out;
}
.rs-pagination .page-link:hover {
  color: var(--rs-primary-dark);
  background-color: #f8f9fa;
  border-color: #dee2e6;
  z-index: 2;
}
.rs-pagination .page-link:focus {
  box-shadow: 0 0 0 0.2rem rgba(var(--rs-primary-rgb), 0.25);
  z-index: 3;
}
.rs-pagination .page-item.active .page-link {
  color: #fff;
  background-color: var(--rs-primary);
  border-color: var(--rs-primary);
  z-index: 3;
}
.rs-pagination .page-item.disabled .page-link {
  color: #c8c8c8;
  background-color: #fff;
  border-color: #dee2e6;
  pointer-events: none;
}
/* Legacy non-.rs-pagination overrides (backward compat) */
.page-item.active .page-link {
  background-color: var(--rs-primary);
  border-color: var(--rs-primary);
}
.page-link {
  color: var(--rs-primary);
}
.page-link:hover {
  color: var(--rs-primary-dark);
}

/* ===================================================================
   12c. TABLE ALIGNMENT & COLUMN WIDTHS
   =================================================================== */
.table > thead > tr > th {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  font-size: var(--rs-font-size-sm);
}
.table > tbody > tr > td {
  vertical-align: middle;
  text-align: center;
}
.table > tbody > tr > td:first-child,
.table > thead > tr > th:first-child {
  text-align: left;
}
.table .text-start {
  text-align: left !important;
}
.table .text-end {
  text-align: right !important;
}

/* ===================================================================
   13. RESPONSIVE SCALING — Medium screens (14" laptops, 1366–1600px)
   Reduce font sizes, spacing, and sidebar width to avoid "oversized"
   feeling on smaller displays while preserving 26" desktop layout.
   =================================================================== */
@media (min-width: 768px) and (max-width: 1599px) {
  :root {
    --rs-font-size-xs: 0.65rem;
    --rs-font-size-sm: 0.78rem;
    --rs-font-size-base: 0.85rem;
    --rs-font-size-lg: 1rem;
    --rs-card-gap: 1rem;
  }

  .sidebar {
    width: 200px;
  }
  .sidebar .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: var(--rs-font-size-sm);
  }
  .sidebar .sidebar-group-label {
    font-size: var(--rs-font-size-xs);
  }

  .dashboard-main {
    margin-left: 200px;
    width: calc(100% - 200px);
    padding: 0 1rem;
  }

  .dashboard-main h1.h2 {
    font-size: 1.3rem;
  }

  .stat-card-icon {
    font-size: 1.6rem;
  }

  .card {
    margin-bottom: 1rem;
  }

  .table {
    font-size: var(--rs-font-size-sm);
  }
  .table > thead > tr > th {
    padding: 0.5rem;
  }
  .table > tbody > tr > td {
    padding: 0.4rem 0.5rem;
  }

  .btn {
    font-size: var(--rs-font-size-sm);
    padding: 0.3rem 0.6rem;
  }
  .btn-sm {
    font-size: var(--rs-font-size-xs);
    padding: 0.2rem 0.4rem;
  }
}

/* Extra compact for very small desktop viewports (< 1366px but > tablet) */
@media (min-width: 768px) and (max-width: 1365px) {
  :root {
    --rs-font-size-base: 0.8rem;
    --rs-font-size-sm: 0.72rem;
  }

  .sidebar {
    width: 180px;
  }
  .dashboard-main {
    margin-left: 180px;
    width: calc(100% - 180px);
  }
}

/* ===================================================================
   14. FOCUS RING (accessibility)
   =================================================================== */
:focus-visible {
  outline: 2px solid var(--rs-primary);
  outline-offset: 2px;
}

/* ===================================================================
   15. SERVER LOG TERMINAL — inline copy-link icon
   =================================================================== */
.log-line {
  position: relative;
}
.log-copy-link {
  opacity: 0;
  cursor: pointer;
  padding: 0 4px;
  color: var(--rs-info);
  transition: opacity 0.15s ease;
  position: absolute;
  right: 8px;
  top: 0;
}
.log-line:hover .log-copy-link {
  opacity: 0.6;
}
.log-copy-link:hover {
  opacity: 1 !important;
  color: #fff;
}

/* ===================================================================
   16. AI CONFIG DASHBOARD — section cards
   =================================================================== */

/* Card container */
.ai-config-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* Dark branded header — matches sidebar gradient */
.ai-config-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(135deg, #2c1810 0%, #3d2018 100%);
  color: #fff;
}

/* Icon badge */
.ai-config-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.4rem;
  background: rgba(217, 54, 54, 0.2);
  color: var(--rs-primary);
  font-size: 1rem;
  flex-shrink: 0;
}

/* Section label */
.ai-config-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* Field row — subtle separator between fields */
.ai-config-field-row {
  border-bottom: 1px solid rgba(0, 0, 0, 0.055);
}
.ai-config-field-row:last-of-type {
  border-bottom: none;
}
.ai-config-field-row:hover {
  background-color: rgba(0, 0, 0, 0.018);
}

/* Config key tag — monospace, clearly subdued */
.ai-config-key {
  font-size: 0.7em;
  font-family: var(--bs-font-monospace);
  color: #888;
  background: transparent;
  padding: 0;
  letter-spacing: 0.03em;
}

/* Range slider value badge — fixed width so label doesn't jump */
.ai-config-range-badge {
  min-width: 2.75rem;
  text-align: center;
  font-size: 0.85rem;
}

/* ===================================================================
   17. PRINT STYLES
   =================================================================== */
@media print {
  .sidebar,
  .sidebar-backdrop,
  .dashboard-mobile-header,
  .bulk-actions-toolbar,
  .btn {
    display: none !important;
  }
  .dashboard-main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
  }
}

/* ===================================================================
   18. TEST CASE DETAIL PAGE
   =================================================================== */

/* ── Accent palette per section ──────────────────────────────────── */
:root {
  --tc-risk-accent:       #d93636;   /* red   — risk/severity */
  --tc-risk-accent-bg:    #fff5f5;
  --tc-detection-accent:  #2563eb;   /* blue  — detection engine */
  --tc-detection-accent-bg: #eff6ff;
  --tc-validation-accent: #059669;   /* green — validation */
  --tc-validation-accent-bg: #ecfdf5;
  --tc-content-accent:    #d97706;   /* amber — content / payloads */
  --tc-content-accent-bg: #fffbeb;
}

/* ── Hero header ──────────────────────────────────────────────────── */
.tc-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border: 1px solid #d8dce4;
  border-left: 4px solid var(--rs-primary);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  flex-wrap: wrap;
}
.tc-hero-left {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.tc-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  background: rgba(217,54,54,.1);
  color: var(--rs-primary);
  font-size: 1.4rem;
  flex-shrink: 0;
}
.tc-hero-id {
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
  color: #888;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}
.tc-hero-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--rs-text-dark);
  margin-bottom: 0.45rem;
}
.tc-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tc-meta-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #f1f3f7;
  color: #5a6070;
  border: 1px solid #e0e3ea;
}
.tc-hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}
.tc-hero-right .badge {
  font-size: 0.85rem;
  padding: 0.45em 0.9em;
}
.tc-hero-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Anchor nav ───────────────────────────────────────────────────── */
.tc-anchor-nav {
  display: flex;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid #d8dce4;
  border-radius: 0.45rem;
  padding: 0.35rem 0.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow-x: auto;
  white-space: nowrap;
}
.tc-anchor-link {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #5a6070;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.tc-anchor-link:hover {
  background: #f1f3f7;
  color: var(--rs-text-dark);
}
.tc-anchor-link.active {
  background: var(--rs-primary);
  color: #fff;
}

/* ── Section cards ────────────────────────────────────────────────── */
.tc-card {
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid #d8dce4;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  overflow: hidden;
  margin-bottom: 0;
}
.tc-card-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #eceef3;
  background: #f7f8fb;
}
.tc-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--rs-text-dark);
  letter-spacing: 0.01em;
}
.tc-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #e9ecf0;
  color: #555;
  font-size: 0.72rem;
  font-weight: 600;
}
.tc-card-body {
  padding: 0.25rem 0;
}

/* Card icon per section */
.tc-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Risk — red */
.tc-card--risk { border-left: 3px solid var(--tc-risk-accent); }
.tc-card--risk .tc-card-header { border-bottom-color: #ffe4e4; }
.tc-card-icon--risk { background: rgba(217,54,54,.12); color: var(--tc-risk-accent); }

/* Detection — blue */
.tc-card--detection { border-left: 3px solid var(--tc-detection-accent); }
.tc-card--detection .tc-card-header { border-bottom-color: #dbeafe; }
.tc-card-icon--detection { background: rgba(37,99,235,.1); color: var(--tc-detection-accent); }

/* Validation — green */
.tc-card--validation { border-left: 3px solid var(--tc-validation-accent); }
.tc-card--validation .tc-card-header { border-bottom-color: #d1fae5; }
.tc-card-icon--validation { background: rgba(5,150,105,.1); color: var(--tc-validation-accent); }

/* Content — amber */
.tc-card--content { border-left: 3px solid var(--tc-content-accent); }
.tc-card--content .tc-card-header { border-bottom-color: #fde68a; }
.tc-card-icon--content { background: rgba(217,119,6,.1); color: var(--tc-content-accent); }

/* ── Key-value rows ───────────────────────────────────────────────── */
.tc-kv-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid #f2f3f6;
}
.tc-kv-row:last-child { border-bottom: none; }
.tc-kv-row--block {
  align-items: flex-start;
}
.tc-kv-label {
  flex: 0 0 160px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tc-kv-value {
  flex: 1;
  font-size: 0.88rem;
  color: var(--rs-text-dark);
  word-break: break-word;
}

/* ── CVSS vector display ──────────────────────────────────────────── */
.tc-cvss-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.tc-cvss-vector {
  font-size: 0.75rem;
  background: #f1f3f7;
  border: 1px solid #e0e3ea;
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  word-break: break-all;
}
.tc-copy-btn {
  background: none;
  border: none;
  padding: 0.1rem 0.3rem;
  color: #aaa;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 0.25rem;
  transition: color 0.15s;
}
.tc-copy-btn:hover { color: var(--rs-primary); }
.tc-cvss-hint {
  font-size: 0.72rem;
  color: #9ca3af;
  margin: 0.4rem 0 0;
}

/* ── Standard tags (OWASP, WSTG) ─────────────────────────────────── */
.tc-standard-tag {
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
}

/* ── Strategy code tag ────────────────────────────────────────────── */
.tc-strategy-code {
  display: inline-block;
  background: #f1f3f7;
  border: 1px solid #e0e3ea;
  color: #374151;
  padding: 0.2rem 0.6rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
}

/* ── Run mode badge ───────────────────────────────────────────────── */
.tc-run-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.tc-run-all  { background: #dbeafe; color: #1d4ed8; }
.tc-run-one  { background: #ede9fe; color: #6d28d9; }
.tc-run-hit  { background: #fef3c7; color: #b45309; }

/* ── Match location badge ─────────────────────────────────────────── */
.tc-location-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  color: #475569;
}

/* ── Boolean flag grid ────────────────────────────────────────────── */
.tc-flag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.tc-flag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.tc-flag--on {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.tc-flag--on i { color: #059669; }
.tc-flag--off {
  background: #f9fafb;
  color: #9ca3af;
  border-color: #e5e7eb;
}
.tc-flag--off i { color: #d1d5db; }

/* ── URL code ─────────────────────────────────────────────────────── */
.tc-url-code {
  font-size: 0.76rem;
  word-break: break-all;
  background: #f1f3f7;
  border: 1px solid #e0e3ea;
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
}

/* ── Validation boost tiles ───────────────────────────────────────── */
.tc-boost-tile {
  border-radius: 0.45rem;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  height: 100%;
}
.tc-boost-tile--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.tc-boost-tile--danger {
  background: #fff5f5;
  border-color: #fecaca;
}
.tc-boost-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 0.35rem;
}
.tc-boost-tile--success .tc-boost-label i { color: #059669; }
.tc-boost-tile--danger  .tc-boost-label i { color: #dc2626; }
.tc-boost-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--bs-font-monospace);
  color: var(--rs-text-dark);
}
.tc-boost-tile--success .tc-boost-value { color: #065f46; }
.tc-boost-tile--danger  .tc-boost-value { color: #991b1b; }

/* ── Description pre ──────────────────────────────────────────────── */
.tc-description-pre {
  background: #f7f8fb;
  border: 1px solid #eceef3;
  border-radius: 0.4rem;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #374151;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0.5rem 1.25rem;
}

/* ── Code list (patterns / payloads) ─────────────────────────────── */
.tc-code-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tc-code-list li {
  padding: 0.45rem 1.25rem;
  border-bottom: 1px solid #f2f3f6;
  font-size: 0.82rem;
}
.tc-code-list li:last-child { border-bottom: none; }
.tc-code-list code {
  background: #f7f8fb;
  border: 1px solid #eceef3;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
}

/* ── Injection point tags ─────────────────────────────────────────── */
.tc-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
}
.tc-param-tag {
  display: inline-block;
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 0.35rem;
}

/* ── Collection link ──────────────────────────────────────────────── */
.tc-collection-link {
  color: var(--rs-primary);
  text-decoration: none;
  font-weight: 500;
}
.tc-collection-link:hover { text-decoration: underline; }

/* ── Responsive tweaks ────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .tc-kv-label { flex: 0 0 120px; }
  .tc-flag-grid { grid-template-columns: 1fr; }
  .tc-hero { flex-direction: column; }
  .tc-hero-right { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}
@media (min-width: 768px) and (max-width: 1599px) {
  .tc-kv-label { flex: 0 0 140px; font-size: 0.72rem; }
  .tc-kv-value { font-size: 0.82rem; }
  .tc-hero-name { font-size: 0.95rem; }
  .tc-boost-value { font-size: 1.25rem; }
}

/* ===================================================================
   18. KNOWLEDGE BASES PAGE (kb_list)
   =================================================================== */

/* ── Toolbar ── */
.kb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
  background: linear-gradient(135deg, #2c1810 0%, #3d2018 100%);
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.kb-toolbar-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.kb-search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.kb-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.45);
  font-size: 0.8rem;
  pointer-events: none;
}

.kb-search-input {
  width: 100%;
  padding: 0.35rem 2.2rem 0.35rem 2rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0.35rem;
  color: #fff;
  font-size: var(--rs-font-size-sm);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.kb-search-input::placeholder { color: rgba(255,255,255,0.35); }
.kb-search-input:focus {
  outline: none;
  border-color: var(--rs-primary);
  background: rgba(255,255,255,0.12);
}

.kb-search-clear {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 0.7rem;
  text-decoration: none;
  line-height: 1;
  transition: color 0.15s;
}
.kb-search-clear:hover { color: #fff; }

/* ── Main card ── */
.kb-main-card {
  border: 1px solid #cdd1d9 !important;
  border-radius: 0.5rem;
  overflow: hidden;
}

/* ── Dark branded card header ── */
.kb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #2c1810 0%, #3d2018 100%);
  border-bottom: 2px solid var(--rs-primary);
}

.kb-card-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kb-card-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.4rem;
  background: rgba(217, 54, 54, 0.25);
  color: var(--rs-primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.kb-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.02em;
}

.kb-card-subtitle {
  font-size: var(--rs-font-size-xs);
  color: rgba(255,255,255,0.5);
  margin-top: 0.1rem;
}

/* ── Table ── */
.kb-table {
  width: 100%;
  border-collapse: collapse;
}

.kb-table thead tr {
  background: #f7f3f2;
  border-bottom: 2px solid #e0d5d3;
}

.kb-table thead th {
  padding: 0.65rem 0.85rem;
  font-size: var(--rs-font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b3a35;
  white-space: nowrap;
  vertical-align: middle;
  border: none;
}

/* column widths */
.kb-th-check  { width: 42px; text-align: center; }
.kb-th-name   { width: 22%; text-align: left; }
.kb-th-desc   { width: 28%; text-align: left; }
.kb-th-count  { width: 11%; text-align: center; }
.kb-th-owner  { width: 13%; text-align: left; }
.kb-th-date   { width: 11%; text-align: left; }
.kb-th-actions{ width: 10%; text-align: center; }

/* ── Sort links ── */
.kb-sort-link {
  color: #6b3a35;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0;
  transition: color 0.15s;
}
.kb-sort-link:hover { color: var(--rs-primary); }

/* ── Body rows ── */
.kb-table tbody tr.kb-row {
  border-bottom: 1px solid #ede8e7;
  transition: background-color 0.15s ease, border-left-color 0.15s ease;
  border-left: 3px solid transparent;
}

.kb-table tbody tr.kb-row:last-child {
  border-bottom: none;
}

.kb-table tbody tr.kb-row:hover {
  background-color: #fdf5f4;
  border-left-color: var(--rs-primary);
}

.kb-table tbody tr.kb-row:has(.form-check-input:checked) {
  background-color: rgba(217, 54, 54, 0.06);
  border-left-color: var(--rs-primary);
}

/* ── Cell defaults ── */
.kb-table tbody td {
  padding: 0.7rem 0.85rem;
  vertical-align: middle;
  border: none;
  font-size: var(--rs-font-size-sm);
}

.kb-td-check { text-align: center; }
.kb-td-name  { text-align: left; }
.kb-td-desc  { text-align: left; }
.kb-td-count { text-align: center; }
.kb-td-owner { text-align: left; }
.kb-td-date  { text-align: left; }
.kb-td-actions { text-align: center; }

/* ── Name cell ── */
.kb-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.kb-name-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.3rem;
  background: rgba(217, 54, 54, 0.1);
  color: var(--rs-primary);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.kb-name-text {
  font-weight: 600;
  color: #1f2937;
  font-family: var(--bs-font-monospace);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

/* ── Description cell ── */
.kb-desc-text {
  color: #6c757d;
  font-size: var(--rs-font-size-sm);
  line-height: 1.45;
}

/* ── Test-cases badge ── */
.kb-tc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 1rem;
  font-size: var(--rs-font-size-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.kb-tc-badge--active {
  background: rgba(217, 54, 54, 0.12);
  color: var(--rs-primary-dark);
  border: 1px solid rgba(217, 54, 54, 0.25);
}

.kb-tc-badge--empty {
  background: #f0f0f0;
  color: #aaa;
  border: 1px solid #e0e0e0;
}

/* ── Owner cell ── */
.kb-owner-wrap {
  color: #495057;
  font-size: var(--rs-font-size-sm);
}

/* ── Date cell ── */
.kb-date-text {
  color: #6c757d;
  font-size: var(--rs-font-size-sm);
  font-family: var(--bs-font-monospace);
}

/* ── View button ── */
.kb-btn-view {
  background: transparent;
  border: 1px solid rgba(217, 54, 54, 0.35);
  color: var(--rs-primary);
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.kb-btn-view:hover {
  background: var(--rs-primary);
  border-color: var(--rs-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(217,54,54,0.3);
}

/* ── Pagination wrapper ── */
.kb-pagination-wrap {
  padding: 0.75rem 1rem;
  border-top: 1px solid #ede8e7;
  background: #faf8f7;
}

/* ── Empty state ── */
.kb-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.5rem 1rem;
  text-align: center;
}

.kb-empty-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: rgba(217, 54, 54, 0.08);
  border: 2px solid rgba(217, 54, 54, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: rgba(217, 54, 54, 0.45);
  margin-bottom: 1rem;
}

.kb-empty-icon--search {
  background: rgba(108, 117, 125, 0.08);
  border-color: rgba(108, 117, 125, 0.15);
  color: rgba(108, 117, 125, 0.5);
}

.kb-empty-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f2937;
  margin-bottom: 0.35rem;
}

.kb-empty-sub {
  font-size: var(--rs-font-size-sm);
  color: #6c757d;
  max-width: 340px;
  margin-bottom: 1.25rem;
}

/* ── Responsive ── */
@media (max-width: 767.98px) {
  .kb-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .kb-toolbar-form { max-width: 100%; }
  .kb-search-wrap  { max-width: 100%; }

  .kb-th-desc, .kb-td-desc { display: none; }
  .kb-th-owner, .kb-td-owner { display: none; }
}

@media (min-width: 768px) and (max-width: 1599px) {
  .kb-table thead th  { padding: 0.5rem 0.65rem; }
  .kb-table tbody td  { padding: 0.5rem 0.65rem; }
}

/* ===================================================================
   19. TEST CASE EDIT PAGE
   =================================================================== */

/* ── Sticky action bar ────────────────────────────────────────────── */
.tce-action-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid #d8dce4;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.tce-action-bar--scrolled {
  box-shadow: 0 4px 16px rgba(0,0,0,.13);
  border-color: #c5c9d4;
}
.tce-action-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  flex-wrap: wrap;
}
.tce-action-bar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--rs-text-dark);
  min-width: 0;
}
.tce-action-bar-id {
  font-family: var(--bs-font-monospace);
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.tce-dirty-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 0.1rem 0.55rem 0.1rem 0.25rem;
  white-space: nowrap;
}
.tce-dirty-badge .bi-dot {
  font-size: 1.2rem;
  line-height: 1;
  color: #d97706;
}
.tce-action-bar-btns {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Section cards ────────────────────────────────────────────────── */
.tce-section {
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid #d8dce4;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.tce-section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eceef3;
}
.tce-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--rs-text-dark);
  line-height: 1.3;
}
.tce-section-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.15rem;
}
.tce-section-body {
  padding: 1.25rem 1.5rem;
}

/* Section icon squares */
.tce-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

/* Identity — slate */
.tce-section-header--identity { border-left: 3px solid #475569; background: #f8fafc; border-bottom-color: #e2e8f0; }
.tce-section-icon--identity   { background: rgba(71,85,105,.1); color: #475569; }

/* Risk — red */
.tce-section-header--risk     { border-left: 3px solid var(--tc-risk-accent); background: #fff8f8; border-bottom-color: #ffe4e4; }
.tce-section-icon--risk       { background: rgba(217,54,54,.1); color: var(--tc-risk-accent); }

/* Detection — blue */
.tce-section-header--detection { border-left: 3px solid var(--tc-detection-accent); background: #f0f7ff; border-bottom-color: #dbeafe; }
.tce-section-icon--detection   { background: rgba(37,99,235,.1); color: var(--tc-detection-accent); }

/* Validation — green */
.tce-section-header--validation { border-left: 3px solid var(--tc-validation-accent); background: #f0fdf8; border-bottom-color: #d1fae5; }
.tce-section-icon--validation   { background: rgba(5,150,105,.1); color: var(--tc-validation-accent); }

/* Content — amber */
.tce-section-header--content  { border-left: 3px solid var(--tc-content-accent); background: #fffdf0; border-bottom-color: #fde68a; }
.tce-section-icon--content    { background: rgba(217,119,6,.1); color: var(--tc-content-accent); }

/* ── Form fields ──────────────────────────────────────────────────── */
.tce-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.tce-required {
  color: var(--tc-risk-accent);
  margin-left: 0.15rem;
}
.tce-hint {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.3rem;
  line-height: 1.45;
}
.tce-input {
  font-size: 0.875rem;
  border-color: #d1d5db;
  background: #fafafa;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.tce-input:focus {
  background: #fff;
  border-color: var(--rs-primary);
  box-shadow: 0 0 0 3px rgba(217,54,54,.12);
}
.tce-textarea {
  resize: vertical;
  min-height: 90px;
}
.tce-cvss-input {
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

/* ── Subsection label inside a section body ───────────────────────── */
.tce-subsection-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #e5e7eb;
}
.tce-subsection-note {
  font-weight: 400;
  font-size: 0.68rem;
  color: #9ca3af;
  text-transform: none;
  letter-spacing: 0;
  margin-left: auto;
}

/* ── OOB hint block ───────────────────────────────────────────────── */
.tce-oob-hint {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.4rem;
  padding: 0.65rem 0.9rem;
}
.tce-oob-hint-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.4rem;
}
.tce-oob-hint-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}
.tce-oob-hint-vars code {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
}
.tce-oob-hint-note {
  font-size: 0.7rem;
  color: #3b82f6;
  line-height: 1.5;
}
.tce-oob-hint-note code {
  background: #dbeafe;
  border: none;
  color: #1d4ed8;
  font-size: 0.68rem;
}

/* ── Boolean flag toggles ─────────────────────────────────────────── */
.tce-flag-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.tce-flag-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
  position: relative;
}
.tce-flag-toggle:hover {
  border-color: #c0c7d0;
  background: #f3f4f6;
}
.tce-flag-toggle--on {
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.tce-flag-toggle--on:hover {
  border-color: #6ee7b7;
  background: #d1fae5;
}
.tce-flag-cb {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.tce-flag-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  background: #e9ecf0;
  color: #6b7280;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.tce-flag-toggle--on .tce-flag-toggle-icon {
  background: rgba(5,150,105,.15);
  color: #059669;
}
.tce-flag-toggle-body {
  flex: 1;
  min-width: 0;
}
.tce-flag-toggle-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tce-flag-toggle--on .tce-flag-toggle-title {
  color: #065f46;
}
.tce-flag-toggle-desc {
  display: block;
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.1rem;
  line-height: 1.3;
}
.tce-flag-toggle--on .tce-flag-toggle-desc {
  color: #6ee7b7;
  color: #34d399;
}
/* ON/OFF pill at right */
.tce-flag-toggle-state::after {
  content: 'OFF';
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #e9ecf0;
  color: #9ca3af;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.tce-flag-toggle--on .tce-flag-toggle-state::after {
  content: 'ON';
  background: #059669;
  color: #fff;
}

/* ── Input group addons (boost/loss) ──────────────────────────────── */
.tce-input-addon {
  background: #f3f4f6;
  border-color: #d1d5db;
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 2.5rem;
  justify-content: center;
}
.tce-input-addon--success { color: #059669; }
.tce-input-addon--danger  { color: #dc2626; }

/* ── Injection point chip grid ────────────────────────────────────── */
.tce-ip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tce-ip-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}
.tce-ip-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.tce-ip-chip:hover {
  border-color: #c0c7d0;
  background: #f3f4f6;
  color: #374151;
}
.tce-ip-chip--on {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}
.tce-ip-chip--on:hover {
  border-color: #60a5fa;
  background: #dbeafe;
}
.tce-ip-chip i {
  font-size: 0.85rem;
}

/* ── Bottom save bar ──────────────────────────────────────────────── */
.tce-bottom-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 0 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid #eceef3;
}

/* ── Unsaved changes modal ────────────────────────────────────────── */
.tce-unsaved-modal {
  border-top: 3px solid var(--bs-warning);
  border-radius: 0.75rem;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .tce-flag-edit-grid { grid-template-columns: 1fr; }
  .tce-section-body   { padding: 1rem; }
  .tce-section-header { padding: 0.85rem 1rem; }
  .tce-action-bar-id  { max-width: 140px; }
}
@media (min-width: 768px) and (max-width: 1599px) {
  .tce-section-title    { font-size: 0.85rem; }
  .tce-section-subtitle { font-size: 0.7rem; }
  .tce-label            { font-size: 0.72rem; }
  .tce-input            { font-size: 0.82rem; }
  .tce-flag-toggle-title { font-size: 0.75rem; }
  .tce-flag-toggle-desc  { font-size: 0.66rem; }
}
