/* ==========================================================================
   EuAI ERP - Premium SaaS Dashboard
   Unified light/dark theme with CSS variables
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES & DESIGN TOKENS
   -------------------------------------------------------------------------- */

:root,
[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --panel: #f9fafb;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e2e4e9;
  --card: #ffffff;
  --card-active: #6366f1;
  --card-active-ink: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 10px 25px rgba(0, 0, 0, 0.1);
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-bg: rgba(99, 102, 241, 0.08);
  --primary-ring: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --sidebar-bg: #ffffff;
  --sidebar-text: #374151;
  --sidebar-hover: #f3f4f6;
  --sidebar-active: rgba(99, 102, 241, 0.1);
  --sidebar-border: #e5e7eb;
  --sidebar-icon: #9ca3af;
  --sidebar-foot: #6b7280;
  --sidebar-pill-bg: #f3f4f6;
  --sidebar-pill-border: #e5e7eb;
  --sidebar-pill-text: #4b5563;
  --sidebar-avatar-bg: rgba(99, 102, 241, 0.1);
  --sidebar-avatar-text: #6366f1;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --toast-bg: #1f2937;
  --toast-text: #ffffff;
  --scroll-thumb: rgba(0, 0, 0, 0.12);
  --scroll-hover: rgba(0, 0, 0, 0.2);
  --shell-bg: #ffffff;
  --shell-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
}

[data-theme="dark"] {
  --bg: #0b0d11;
  --surface: #141720;
  --panel: #1a1d28;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --line: #2a2d3a;
  --card: #181b25;
  --card-active: #6366f1;
  --card-active-ink: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-elevated: 0 10px 30px rgba(0, 0, 0, 0.45);
  --primary: #818cf8;
  --primary-light: #a5b4fc;
  --primary-bg: rgba(129, 140, 248, 0.12);
  --primary-ring: rgba(129, 140, 248, 0.2);
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --sidebar-bg: #0f1117;
  --sidebar-text: #d1d5db;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active: rgba(129, 140, 248, 0.15);
  --sidebar-border: #1e2130;
  --sidebar-icon: #6b7280;
  --sidebar-foot: #6b7280;
  --sidebar-pill-bg: rgba(255, 255, 255, 0.06);
  --sidebar-pill-border: rgba(255, 255, 255, 0.08);
  --sidebar-pill-text: #9ca3af;
  --sidebar-avatar-bg: rgba(129, 140, 248, 0.15);
  --sidebar-avatar-text: #a5b4fc;
  --input-bg: #1a1d28;
  --input-border: #2a2d3a;
  --toast-bg: #e5e7eb;
  --toast-text: #111827;
  --scroll-thumb: rgba(255, 255, 255, 0.1);
  --scroll-hover: rgba(255, 255, 255, 0.18);
  --shell-bg: #0f1117;
  --shell-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding: 10px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.auth-locked .app-shell {
  visibility: hidden;
  pointer-events: none;
}

body.auth-locked #loginModal {
  visibility: visible;
  pointer-events: auto;
}

button,
input,
select {
  font: inherit;
}

/* --------------------------------------------------------------------------
   3. SCROLLBARS
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

/* --------------------------------------------------------------------------
   4. APP SHELL LAYOUT
   -------------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 20px);
  background: var(--shell-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shell-shadow);
}

/* --------------------------------------------------------------------------
   5. SIDEBAR
   -------------------------------------------------------------------------- */

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.02);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.brand {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.brand-logo {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0.15rem 0.1rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 52px;
}

.brand-logo img {
  width: 100%;
  max-width: 218px;
  height: auto;
  display: block;
  object-fit: contain;
}

[data-theme="dark"] .brand-logo img {
  filter: brightness(0) invert(1);
}

/* --------------------------------------------------------------------------
   5a. SIDEBAR NAVIGATION
   -------------------------------------------------------------------------- */

.nav-block {
  display: grid;
  gap: 0.2rem;
}

.nav-divider {
  height: 1px;
  margin: 0.4rem 0.75rem;
  background: linear-gradient(
    to right,
    transparent 0%,
    var(--line) 18%,
    var(--line) 82%,
    transparent 100%
  );
  opacity: 0.7;
}

.nav-link {
  border: 1px solid transparent;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  background: transparent;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--sidebar-text);
  position: relative;
  transition: background-color 200ms var(--ease-out),
              color 200ms var(--ease-out),
              transform 200ms var(--ease-out),
              border-color 200ms var(--ease-out);
  cursor: pointer;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0.2);
  transform-origin: center;
  width: 3px;
  height: 60%;
  border-radius: 99px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  border-color: color-mix(in srgb, var(--line) 70%, var(--primary) 30%);
  color: var(--ink);
  transform: translateX(1px);
}

.nav-link:hover::before {
  opacity: 0.55;
  transform: translateY(-50%) scaleY(1);
}

.nav-link.small {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  justify-content: space-between;
}

.nav-link-active {
  background: var(--sidebar-active);
  border-color: color-mix(in srgb, var(--line) 58%, var(--primary) 42%);
  color: var(--primary);
  font-weight: 700;
}

.nav-link-active::before {
  opacity: 1;
  transform: translateY(-50%) scaleY(1);
}

.nav-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  color: var(--sidebar-icon);
  font-size: 0.84rem;
}

.nav-link-active .nav-icon {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   5b. SIDEBAR FOOTER & GROUPS
   -------------------------------------------------------------------------- */

.sidebar-foot {
  margin-top: auto;
}

.side-group {
  margin-top: 0.2rem;
}

.foot-label {
  margin: 0 0 0.6rem;
  color: var(--sidebar-foot);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.pill {
  border-radius: 999px;
  padding: 0.15rem 0.4rem;
  background: var(--sidebar-pill-bg);
  border: 1px solid var(--sidebar-pill-border);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sidebar-pill-text);
}

.project-list {
  display: grid;
  gap: 0.2rem;
  max-height: 188px;
  overflow: auto;
  padding-right: 0.12rem;
}

.member-list {
  display: grid;
  gap: 0.42rem;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 0.24rem 0.35rem;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.member-row:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--sidebar-avatar-bg);
  color: var(--sidebar-avatar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   6. WORKSPACE (MAIN AREA)
   -------------------------------------------------------------------------- */

.workspace {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: var(--bg);
}

.view {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

/* --------------------------------------------------------------------------
   7. VIEW TRANSITION ANIMATIONS
   -------------------------------------------------------------------------- */

.view-animate {
  animation: viewEnter 350ms var(--ease-spring);
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes globalFlyIn {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.992);
    filter: saturate(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: saturate(1);
  }
}

.fly-in-item {
  animation: globalFlyIn 460ms var(--ease-spring) both;
  animation-delay: var(--fly-delay, 0ms);
  will-change: transform, opacity;
}

/* Dashboard card stagger */
.view-animate-dashboard .dash-kpi-row .dash-card {
  animation: dashCardIn 500ms var(--ease-spring) both;
}

.view-animate-dashboard .dash-kpi-row .dash-card:nth-child(2) { animation-delay: 60ms; }
.view-animate-dashboard .dash-kpi-row .dash-card:nth-child(3) { animation-delay: 120ms; }
.view-animate-dashboard .dash-kpi-row .dash-card:nth-child(4) { animation-delay: 180ms; }

.view-animate-dashboard .dash-main-grid .widget,
.view-animate-dashboard .dash-panels-grid .widget {
  animation: dashWidgetIn 550ms var(--ease-spring) both;
}
.view-animate-dashboard .dash-main-grid .widget:nth-child(1) { animation-delay: 120ms; }
.view-animate-dashboard .dash-main-grid .widget:nth-child(2) { animation-delay: 180ms; }
.view-animate-dashboard .dash-panels-grid .widget:nth-child(odd) { animation-delay: 220ms; }
.view-animate-dashboard .dash-panels-grid .widget:nth-child(even) { animation-delay: 280ms; }

/* Tasks stagger */
.view-animate-tasks .tasks-grid .widget {
  animation: tasksPanelIn 450ms var(--ease-spring) both;
}
.view-animate-tasks .tasks-grid .widget:nth-child(2) { animation-delay: 90ms; }
.view-animate-tasks .task-item {
  animation: taskRowSlide 500ms var(--ease-spring) both;
}
.view-animate-tasks .task-item:nth-child(1) { animation-delay: 100ms; }
.view-animate-tasks .task-item:nth-child(2) { animation-delay: 160ms; }
.view-animate-tasks .task-item:nth-child(3) { animation-delay: 220ms; }
.view-animate-tasks .task-item:nth-child(4) { animation-delay: 280ms; }

/* Activity stagger */
.view-animate-activity .activity-item {
  animation: activityPulseIn 480ms var(--ease-spring) both;
}
.view-animate-activity .activity-item:nth-child(1) { animation-delay: 80ms; }
.view-animate-activity .activity-item:nth-child(2) { animation-delay: 140ms; }
.view-animate-activity .activity-item:nth-child(3) { animation-delay: 200ms; }
.view-animate-activity .activity-item:nth-child(4) { animation-delay: 260ms; }

/* Board stagger */
.view-animate-board .kpi-band .kpi-card {
  animation: boardKpiDrop 450ms var(--ease-spring) both;
}
.view-animate-board .kpi-band .kpi-card:nth-child(2) { animation-delay: 60ms; }
.view-animate-board .kpi-band .kpi-card:nth-child(3) { animation-delay: 120ms; }
.view-animate-board .kpi-band .kpi-card:nth-child(4) { animation-delay: 180ms; }
.view-animate-board .column {
  animation: boardColumnRise 550ms var(--ease-spring) both;
}
.view-animate-board .column:nth-child(2) { animation-delay: 70ms; }
.view-animate-board .column:nth-child(3) { animation-delay: 140ms; }
.view-animate-board .column:nth-child(4) { animation-delay: 210ms; }
.view-animate-board .lead-card {
  animation: boardCardFloat 500ms var(--ease-spring) both;
}

/* Settings stagger */
.view-animate-settings .settings-grid .widget {
  animation: settingsTileIn 500ms var(--ease-spring) both;
}
.view-animate-settings .settings-grid .widget:nth-child(2) { animation-delay: 70ms; }
.view-animate-settings .settings-grid .widget:nth-child(3) { animation-delay: 140ms; }
.view-animate-settings .settings-grid .widget:nth-child(4) { animation-delay: 210ms; }
.view-animate-settings .settings-grid .widget:nth-child(5) { animation-delay: 280ms; }

/* Module view staggers */
.view-animate-compliance .module-grid .widget,
.view-animate-projects .module-grid .widget,
.view-animate-matching .module-grid .widget,
.view-animate-timeline .module-grid .widget,
.view-animate-reporting .module-grid .widget,
.view-animate-admin .module-grid .widget,
.view-animate-ops .module-grid .widget {
  animation: settingsTileIn 500ms var(--ease-spring) both;
}

.view-animate-compliance .module-grid .widget:nth-child(2),
.view-animate-projects .module-grid .widget:nth-child(2),
.view-animate-matching .module-grid .widget:nth-child(2),
.view-animate-timeline .module-grid .widget:nth-child(2),
.view-animate-reporting .module-grid .widget:nth-child(2),
.view-animate-admin .module-grid .widget:nth-child(2),
.view-animate-ops .module-grid .widget:nth-child(2) { animation-delay: 80ms; }

.view-animate-compliance .module-grid .widget:nth-child(3),
.view-animate-projects .module-grid .widget:nth-child(3),
.view-animate-matching .module-grid .widget:nth-child(3),
.view-animate-timeline .module-grid .widget:nth-child(3),
.view-animate-reporting .module-grid .widget:nth-child(3),
.view-animate-admin .module-grid .widget:nth-child(3),
.view-animate-ops .module-grid .widget:nth-child(3) { animation-delay: 160ms; }

.view-animate-compliance .module-grid .widget:nth-child(4),
.view-animate-projects .module-grid .widget:nth-child(4),
.view-animate-matching .module-grid .widget:nth-child(4),
.view-animate-timeline .module-grid .widget:nth-child(4),
.view-animate-reporting .module-grid .widget:nth-child(4),
.view-animate-admin .module-grid .widget:nth-child(4),
.view-animate-ops .module-grid .widget:nth-child(4) { animation-delay: 240ms; }

.view-animate-compliance .module-grid .widget:nth-child(5),
.view-animate-projects .module-grid .widget:nth-child(5),
.view-animate-matching .module-grid .widget:nth-child(5),
.view-animate-timeline .module-grid .widget:nth-child(5),
.view-animate-reporting .module-grid .widget:nth-child(5),
.view-animate-admin .module-grid .widget:nth-child(5),
.view-animate-ops .module-grid .widget:nth-child(5) { animation-delay: 320ms; }

/* --------------------------------------------------------------------------
   8. KEYFRAMES
   -------------------------------------------------------------------------- */

@keyframes dashCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dashWidgetIn {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes taskRowSlide {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes activityPulseIn {
  from { opacity: 0; transform: translateX(16px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

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

@keyframes boardColumnRise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes boardCardFloat {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes settingsTileIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --------------------------------------------------------------------------
   9. DASHBOARD - KPI ROW
   -------------------------------------------------------------------------- */

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.05rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-start;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  transition: box-shadow 300ms var(--ease-out), transform 300ms var(--ease-out);
}

.dash-card-highlight {
  background: linear-gradient(135deg, #0d5f3c 0%, #249b62 100%);
  border-color: rgba(72, 182, 122, 0.42);
  box-shadow: 0 10px 26px rgba(23, 125, 78, 0.34);
}

.dash-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
}

.dash-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  transform: translateY(-2px);
}

.dash-label {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.dash-card-highlight .dash-label {
  color: rgba(243, 253, 247, 0.95);
}

.dash-value {
  margin: 0;
  font-size: clamp(2.5rem, 2.2rem + 0.8vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.dash-card-highlight .dash-value {
  color: #f1ffe7;
}

.dash-mini-chart {
  width: 100%;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  border: none;
  padding: 0;
  overflow: visible;
  opacity: 0.7;
}

.dash-card-highlight .dash-mini-chart {
  opacity: 0.82;
}

.dash-mini-chart .sparkline {
  height: 14px;
  min-height: 14px;
}

.dash-kpi-foot {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  margin-top: 0;
  font-size: 0.9rem;
  color: #1e6b3f;
  font-weight: 600;
}

.dash-kpi-chip {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  border: 1px solid rgba(26, 120, 65, 0.32);
  background: rgba(71, 189, 117, 0.12);
}

.dash-kpi-foot.tone-positive .dash-kpi-chip {
  color: #138a49;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.16);
}

.dash-kpi-foot.tone-negative .dash-kpi-chip {
  color: #8f9914;
  border-color: rgba(196, 178, 43, 0.42);
  background: rgba(223, 207, 87, 0.22);
}

.dash-kpi-foot.tone-neutral .dash-kpi-chip {
  color: #2c8a58;
  border-color: rgba(44, 138, 88, 0.3);
  background: rgba(62, 160, 108, 0.16);
}

.dash-card-highlight .dash-kpi-foot {
  color: rgba(237, 255, 229, 0.96);
}

.dash-card-highlight .dash-kpi-foot .dash-kpi-chip {
  color: #ecffd7;
  border-color: rgba(236, 255, 215, 0.44);
  background: rgba(236, 255, 215, 0.2);
}

/* --------------------------------------------------------------------------
   10. SPARKLINES & MINI CHARTS
   -------------------------------------------------------------------------- */

.sparkline {
  width: 100%;
  height: 48px;
}

.sparkline polyline {
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: sparkDraw 900ms var(--ease-out) forwards;
}

@keyframes sparkDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.mini-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 0.35rem;
  width: 100%;
  height: 42px;
}

.mini-bar {
  display: block;
  width: 100%;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  animation: miniBarRise 450ms var(--ease-spring);
}

@keyframes miniBarRise {
  from {
    height: 8% !important;
    opacity: 0.3;
  }
}

.mini-stack {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--line);
  background: var(--panel);
}

.mini-seg {
  display: block;
  height: 100%;
  transition: width 400ms var(--ease-spring);
}

.mini-seg-closed {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.mini-seg-active {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.mini-seg-blocked {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}

.mini-stack-legend {
  margin-top: 0.28rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.mini-stack-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.mini-stack-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.mini-stack-legend .dot.closed { background: var(--success); }
.mini-stack-legend .dot.active { background: var(--primary); }
.mini-stack-legend .dot.blocked { background: var(--error); }

/* --------------------------------------------------------------------------
   11. DASHBOARD - MAIN & PANELS GRIDS
   -------------------------------------------------------------------------- */

.dash-main-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.65rem;
}

.dash-panels-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

/* --------------------------------------------------------------------------
   12. EUAI CARD (Agent Monitor)
   -------------------------------------------------------------------------- */

.euai-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(99, 102, 241, 0.18);
  position: relative;
  overflow: hidden;
}

.euai-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-top: 3px solid color-mix(in srgb, var(--primary) 72%, #10b981 28%);
  pointer-events: none;
}

.euai-head {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.euai-avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  background: linear-gradient(145deg, #eef0ff 0%, #e8ebff 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.euai-avatar {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.euai-avatar-wrap .euai-fallback {
  display: none;
}

.euai-avatar-wrap.is-fallback .euai-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.euai-intro {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.euai-intro h3 {
  margin: 0;
  font-size: 1.26rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0;
  line-height: 1.1;
}

.euai-kicker {
  margin: 0 0 0.18rem;
  color: var(--primary);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.euai-text {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.euai-metrics {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.euai-metric {
  min-width: 0;
  padding: 0.62rem 0.68rem;
  border: 1px solid color-mix(in srgb, var(--line) 82%, var(--primary) 18%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, var(--panel) 12%);
}

.euai-metric span {
  display: block;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.euai-metric strong {
  display: block;
  margin-top: 0.22rem;
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.18rem;
  line-height: 1;
}

.euai-agent-chips {
  margin-top: 0.84rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  position: relative;
  z-index: 1;
}

.euai-agent-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  max-width: 100%;
  padding: 0.26rem 0.52rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.15;
}

.euai-agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  flex: 0 0 auto;
}

.euai-agent-dot-active,
.euai-agent-dot-done {
  background: #10b981;
}

.euai-agent-dot-warn {
  background: #f59e0b;
}

.euai-agent-dot-ready {
  background: #818cf8;
}

.euai-foot {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   13. PERFORMANCE CHART
   -------------------------------------------------------------------------- */

.dash-performance {
  background: var(--surface);
}

.dash-performance .widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.subtle-pill {
  background: var(--primary-bg);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 999px;
  padding: 0.15rem 0.4rem;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.dash-performance-chart {
  min-height: 188px;
  border-radius: 0;
  border: 0;
  background: transparent;
  display: block;
  padding: 0.15rem 0 0;
}

.performance-svg {
  width: 100%;
  height: 132px;
}

.performance-grid line {
  stroke: rgba(99, 102, 241, 0.08);
  stroke-width: 1;
}

.performance-area {
  fill: rgba(99, 102, 241, 0.08);
}

.performance-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: perfDraw 1000ms var(--ease-out) forwards;
}

.performance-point {
  fill: var(--primary);
  stroke: #fff;
  stroke-width: 2;
}

@keyframes perfDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.dash-performance-meta {
  margin-top: 0.42rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.34rem;
}

.metric-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 0.18rem 0.46rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

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

.dot-dot.dot-closed {
  background: var(--success);
}

.dot-dot.dot-active {
  background: var(--primary);
}

.dot-dot.dot-blocked {
  background: var(--error);
}

.pipeline-combo-chart {
  position: relative;
  min-height: 184px;
}

.pipeline-combo-trend {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pipeline-combo-guideline {
  stroke: rgba(99, 102, 241, 0.08);
  stroke-width: 0.28;
}

.pipeline-combo-line {
  fill: none;
  stroke: url(#pipelineTrendFade);
  stroke-width: 0.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: perfDraw 1000ms var(--ease-out) forwards;
}

.pipeline-combo-point {
  fill: var(--primary);
  opacity: 0.7;
  pointer-events: auto;
  transition: opacity 130ms var(--ease-out), transform 130ms var(--ease-out);
}

.pipeline-combo-point:is(:hover, :focus-visible) {
  opacity: 1;
  transform: scale(1.08);
  outline: none;
}

.pipeline-combo-rows {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.pipeline-combo-row {
  display: grid;
  grid-template-columns: minmax(96px, 1.2fr) minmax(0, 3fr) 36px;
  gap: 0.45rem;
  align-items: center;
  min-height: 24px;
}

.pipeline-combo-stage {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-combo-bar-wrap {
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.pipeline-combo-bar {
  height: 100%;
  min-width: 8%;
  border-radius: 999px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.06);
}

.pipeline-combo-seg {
  height: 100%;
}

.pipeline-combo-seg.closed {
  background: linear-gradient(90deg, #22c55e, #34d399);
}

.pipeline-combo-seg.active {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.pipeline-combo-seg.blocked {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.pipeline-combo-total {
  text-align: right;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink);
}

@media (max-width: 900px) {
  .dash-performance-chart {
    min-height: 176px;
  }

  .pipeline-combo-row {
    grid-template-columns: minmax(80px, 1.1fr) minmax(0, 3fr) 32px;
    gap: 0.38rem;
  }

  .pipeline-combo-stage,
  .pipeline-combo-total {
    font-size: 0.64rem;
  }
}

/* --------------------------------------------------------------------------
   14. WIDGETS (General Card Containers)
   -------------------------------------------------------------------------- */

.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.72rem;
  box-shadow: var(--shadow);
  transition: box-shadow 300ms var(--ease-out), transform 300ms var(--ease-out);
}

.widget:hover {
  box-shadow: var(--shadow-hover);
}

.widget-head h3 {
  margin: 0 0 0.48rem;
  font-size: 0.91rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   15. FUNNEL LIST & BARS
   -------------------------------------------------------------------------- */

.funnel-list {
  display: grid;
  gap: 0.4rem;
}

.funnel-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.45fr) 1fr 40px;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.79rem;
  min-height: 22px;
}

.funnel-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-bar-wrap {
  width: 100%;
  height: 7px;
  border-radius: 99px;
  background: var(--panel);
  overflow: hidden;
}

.dash-funnel-widget {
  padding: 0.8rem 0.9rem;
}

.dash-funnel-widget .widget-head {
  margin-bottom: 0.35rem;
}

.dash-funnel-widget .funnel-list {
  gap: 0.3rem;
}

.funnel-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 600ms var(--ease-spring);
  min-width: 4px;
}

/* --------------------------------------------------------------------------
   16. ACTIVITY LIST
   -------------------------------------------------------------------------- */

.activity-list {
  display: grid;
  gap: 0.45rem;
}

.activity-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem;
  background: var(--surface);
  transition: box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}

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

.activity-item-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.activity-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.activity-sub {
  margin: 0.22rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.activity-stream-item {
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow);
}

.activity-reentry-widget,
.activity-filter-widget {
  margin-bottom: 0.55rem;
}

.activity-filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 0.55rem;
  align-items: end;
}

.field-inline {
  display: grid;
  gap: 0.3rem;
}

.field-inline span {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-inline select,
.field-inline input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  font-size: 0.84rem;
  background: var(--surface);
  color: var(--ink);
}

.activity-search-inline {
  grid-column: span 2;
}

.activity-type-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.74rem;
  cursor: pointer;
}

.activity-type-chip.is-active {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line) 62%);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface) 90%);
}

.activity-day-group {
  display: grid;
  gap: 0.35rem;
}

.activity-day-label {
  margin: 0.3rem 0 0.1rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.activity-event-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: start;
}

.activity-severity-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 0.2rem;
  background: var(--line);
}

.activity-severity-dot.info {
  background: color-mix(in srgb, var(--primary) 55%, #9ca3af 45%);
}

.activity-severity-dot.warning {
  background: #f59e0b;
}

.activity-severity-dot.critical {
  background: #ef4444;
}

.activity-event-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.activity-event-meta {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
  margin-top: 0.22rem;
}

.activity-load-more-wrap {
  margin-top: 0.6rem;
  display: flex;
  justify-content: center;
}

@media (max-width: 980px) {
  .activity-filter-row {
    grid-template-columns: 1fr 1fr;
  }
  .activity-search-inline {
    grid-column: span 2;
  }
}

/* --------------------------------------------------------------------------
   17. QUICK ACTIONS
   -------------------------------------------------------------------------- */

.quick-actions {
  display: grid;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   18. TASKS VIEW
   -------------------------------------------------------------------------- */

.tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.1rem;
}

.tasks-head h1 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.03em;
  font-size: 1.42rem;
  color: var(--ink);
}

.tasks-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.55rem;
  align-items: start;
}

.tasks-grid-compact .widget {
  padding: 0.62rem;
}

.task-side-stack {
  display: grid;
  gap: 0.55rem;
}

/* --------------------------------------------------------------------------
   19. SETTINGS & MODULE GRIDS
   -------------------------------------------------------------------------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: start;
  grid-auto-rows: min-content;
}

.module-card {
  min-height: 0;
}

.module-span-2 {
  grid-column: span 2;
}

.reporting-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.report-kpi {
  padding: 0.72rem 0.8rem;
}

/* --------------------------------------------------------------------------
   20. FINDINGS & RECOMMENDATIONS
   -------------------------------------------------------------------------- */

.finding-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem;
  background: var(--surface);
  display: grid;
  gap: 0.34rem;
  transition: box-shadow 200ms var(--ease-out);
}

.finding-item:hover {
  box-shadow: var(--shadow-hover);
}

.finding-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
}

.tag-critical {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 999px;
  padding: 0.15rem 0.42rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.tag-warn {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 999px;
  padding: 0.15rem 0.42rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.tag-ok {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: 999px;
  padding: 0.15rem 0.42rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.reco-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.62rem;
  display: grid;
  gap: 0.4rem;
}

.reco-lenders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.42rem;
  transition: background-color 200ms var(--ease-out);
}

.chip:hover {
  background: var(--primary-bg);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   21. HEALTH ROWS
   -------------------------------------------------------------------------- */

.health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.62rem;
  transition: box-shadow 200ms var(--ease-out);
}

.health-row:hover {
  box-shadow: var(--shadow-hover);
}

.health-pill {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.15rem 0.42rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.health-pill.ok {
  background: #f0fdf4;
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.15);
}

.health-pill.warn {
  background: #fffbeb;
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.15);
}

/* --------------------------------------------------------------------------
   22. FILTER ROW & INLINE ACTIONS
   -------------------------------------------------------------------------- */

.filter-row {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.filter-row select {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.4rem 0.55rem;
  color: var(--ink);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.filter-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.inline-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.4rem;
  align-items: center;
}

.inline-actions > input,
.inline-actions > select,
.inline-actions > button {
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  font-size: 0.85rem;
  line-height: 1;
}

.inline-actions > input,
.inline-actions > select {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 0.6rem;
  color: var(--ink);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.inline-actions > select {
  padding-right: 1.75rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.inline-actions > button {
  padding: 0 0.9rem;
  border-radius: 8px;
  white-space: nowrap;
}

.inline-actions > input:focus,
.inline-actions > select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.inline-actions > .span-2 {
  grid-column: span 2;
}

/* --------------------------------------------------------------------------
   23. SETTINGS FORM
   -------------------------------------------------------------------------- */

.settings-form {
  display: grid;
  gap: 0.55rem;
}

.settings-form label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.settings-form input,
.settings-form select {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.4rem 0.55rem;
  color: var(--ink);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.settings-form input:focus,
.settings-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.profile-image-settings {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.profile-image-settings img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  object-fit: cover;
}

.profile-image-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.profile-image-actions .btn {
  width: 100%;
}

/* --------------------------------------------------------------------------
   23b. AI STATUS PANEL
   -------------------------------------------------------------------------- */

.ai-status-panel {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.ai-status-headline {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  gap: 1rem;
}

.ai-status-row + .ai-status-row {
  border-top: 1px solid var(--line);
}

.ai-status-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.ai-status-value {
  font-size: 0.84rem;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-word;
}

.ai-status-panel code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

/* --------------------------------------------------------------------------
   23c. LIVE PULSE BADGE — modern animated status indicator
   -------------------------------------------------------------------------- */

.live-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 28px;
  padding: 0 0.7rem 0 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  position: relative;
  flex: 0 0 auto;
}

.live-pulse-badge.is-loading {
  color: var(--muted);
}

.live-pulse-badge.is-loading .live-pulse-dot {
  background: var(--muted);
  opacity: 0.5;
}

.live-pulse-badge.is-live {
  color: #047857;
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, 0.35);
}

.live-pulse-badge.is-live .live-pulse-dot {
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: livePulseGreen 1.6s ease-out infinite;
}

.live-pulse-badge.is-local {
  color: #92400e;
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.35);
}

.live-pulse-badge.is-local .live-pulse-dot {
  background: #f59e0b;
}

.live-pulse-badge.is-error {
  color: #b91c1c;
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.35);
}

.live-pulse-badge.is-error .live-pulse-dot {
  background: #ef4444;
  animation: livePulseRed 1s ease-in-out infinite;
}

@keyframes livePulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes livePulseRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Dark theme adjustments */
[data-theme="dark"] .live-pulse-badge.is-live {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

[data-theme="dark"] .live-pulse-badge.is-local {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

[data-theme="dark"] .live-pulse-badge.is-error {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* AI Analysis card in agent results */
.ai-analysis-card {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-ring), transparent);
  border: 1px solid var(--primary);
  position: relative;
  overflow: hidden;
}

.ai-analysis-card::before {
  content: '✦ AI';
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.ai-analysis-card h4 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
}

.ai-analysis-card p {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.ai-analysis-card ul {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0;
}

.ai-analysis-card li {
  font-size: 0.78rem;
  color: var(--ink);
  padding: 0.15rem 0;
  padding-left: 1rem;
  position: relative;
}

.ai-analysis-card li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 600;
}

.ai-analysis-container {
  display: grid;
  gap: 0.55rem;
}

.ai-analysis-container .meta-muted {
  padding: 0.5rem 0;
}

.precheck-catalog-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, #ffffff 6%);
}

.precheck-catalog-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.precheck-catalog-table th,
.precheck-catalog-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.precheck-catalog-table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.76rem;
}

.precheck-catalog-table tbody tr:last-child td {
  border-bottom: 0;
}

.precheck-catalog-table tbody tr:hover {
  background: color-mix(in srgb, var(--surface) 86%, var(--primary-ring) 14%);
}

.precheck-question-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  padding: 0 0.4rem;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line) 70%);
  background: color-mix(in srgb, var(--primary) 11%, var(--surface) 89%);
  color: var(--ink);
  font-weight: 700;
}

.precheck-table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background 160ms var(--ease-out);
}

.icon-action-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action-btn:hover,
.icon-action-btn:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line) 60%);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

.icon-action-btn.primary {
  color: #fff;
  background: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 72%, var(--line) 28%);
}

.icon-action-btn.primary:hover,
.icon-action-btn.primary:focus-visible {
  background: color-mix(in srgb, var(--ink) 88%, #ffffff 12%);
}

.icon-action-btn.danger:hover,
.icon-action-btn.danger:focus-visible {
  border-color: color-mix(in srgb, #ef4444 44%, var(--line) 56%);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.icon-action-btn.danger {
  color: rgba(185, 28, 28, 0.92);
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.04);
}

.lead-detail-action-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lead-detail-action-bar.hidden {
  display: none;
}

.customer-mail-modal-card {
  width: min(980px, 95vw);
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.customer-mail-modal-body {
  display: grid;
  gap: 0.6rem;
  overflow-y: auto;
  padding-right: 0.2rem;
  padding-bottom: 0.25rem;
  min-height: 0;
}

.customer-mail-modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.customer-mail-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  position: sticky;
  bottom: -1px;
  z-index: 1;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.customer-mail-action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.customer-mail-upload-hint {
  border: 1px dashed color-mix(in srgb, var(--line) 78%, var(--primary) 22%);
  background: color-mix(in srgb, var(--surface) 97%, var(--primary) 3%);
  border-radius: 8px;
  padding: 0.42rem 0.62rem;
  display: grid;
  gap: 0.16rem;
}

.customer-mail-upload-hint strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.customer-mail-upload-hint .meta-muted {
  font-size: 0.76rem;
  line-height: 1.35;
}

#customerMailBody {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.86rem;
  min-height: 170px;
  max-height: 250px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.55;
  resize: vertical;
}

#customerMailBody:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line) 50%);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

#customerMailSubject {
  display: block;
  width: 100%;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.65rem 0.9rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.customer-mail-modal-body .field input,
.customer-mail-modal-body .field select,
.customer-mail-modal-body .field textarea {
  width: 100%;
  max-width: 100%;
}

#customerMailSubject:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line) 50%);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

#customerMailTemplate {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.55rem 2.4rem 0.55rem 0.85rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.85rem center / 12px 12px,
    var(--surface);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}

#customerMailTemplate:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line) 50%);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.customer-mail-modal-body .field label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

.check-row-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background 160ms var(--ease-out);
  flex-shrink: 0;
}

.check-row-action-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.check-row-action-btn:hover:not(:disabled),
.check-row-action-btn:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line) 58%);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

.check-row-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Customer-Mail success overlay --------------------------------- */
.customer-mail-success {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-radius: inherit;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease-out);
}

.customer-mail-success.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.customer-mail-modal-card {
  position: relative;
}

.customer-mail-success-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.8rem 2rem;
  text-align: center;
  transform: scale(0.94);
  opacity: 0;
  transition: transform 280ms var(--ease-out), opacity 280ms var(--ease-out);
}

.customer-mail-success.is-visible .customer-mail-success-card {
  transform: scale(1);
  opacity: 1;
}

.customer-mail-success-check svg {
  width: 64px;
  height: 64px;
}

.customer-mail-success-circle {
  fill: none;
  stroke: #16a34a;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}

.customer-mail-success-path {
  fill: none;
  stroke: #16a34a;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}

.customer-mail-success.is-visible .customer-mail-success-circle {
  animation: customer-mail-circle-draw 420ms var(--ease-out, ease-out) 80ms forwards;
}

.customer-mail-success.is-visible .customer-mail-success-path {
  animation: customer-mail-check-draw 260ms var(--ease-out, ease-out) 460ms forwards;
}

@keyframes customer-mail-circle-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes customer-mail-check-draw {
  to { stroke-dashoffset: 0; }
}

.customer-mail-success-text {
  display: grid;
  gap: 4px;
}

.customer-mail-success-text strong {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: reduce) {
  .customer-mail-success-card,
  .customer-mail-success.is-visible .customer-mail-success-card,
  .customer-mail-success.is-visible .customer-mail-success-circle,
  .customer-mail-success.is-visible .customer-mail-success-path {
    transition: none;
    animation: none;
    transform: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

/* Tone-Banner unter dem Template-Dropdown ----------------------- */
.customer-mail-tone-banner {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.55rem 0.75rem;
  font-size: 0.84rem;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.customer-mail-tone-banner.tone-primary {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface) 94%);
  border-color: color-mix(in srgb, var(--primary) 32%, var(--line) 68%);
  color: var(--ink);
}

.customer-mail-tone-banner.tone-warn {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.32);
  color: rgba(153, 27, 27, 0.95);
}

.customer-mail-tone-banner svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Follow-up Block im Erfolgs-Overlay (z.B. Lead archivieren?) --- */
.customer-mail-follow-up {
  margin-top: 0.4rem;
  display: grid;
  gap: 0.55rem;
  text-align: center;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding-top: 0.9rem;
  width: 100%;
  max-width: 380px;
}

.customer-mail-follow-up.hidden { display: none; }

.customer-mail-follow-up-question {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.customer-mail-follow-up-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.customer-mail-follow-up-actions .btn-danger {
  background: rgba(239, 68, 68, 0.08);
  color: rgba(153, 27, 27, 0.95);
  border-color: rgba(239, 68, 68, 0.32);
}

.customer-mail-follow-up-actions .btn-danger:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Send-Button im Warn-Ton wenn polite_rejection aktiv ist ------ */
#customerMailSendBtn.is-warn {
  background: rgba(185, 28, 28, 0.95);
  border-color: rgba(185, 28, 28, 0.95);
}

#customerMailSendBtn.is-warn:hover:not(:disabled) {
  background: rgba(153, 27, 27, 1);
  border-color: rgba(153, 27, 27, 1);
}

/* Storage-Health im Settings-Tab ------------------------------- */
.storage-health-summary {
  margin: 12px 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.92rem;
}

.storage-health-summary p { margin: 0; }

.storage-health-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.storage-health-list.hidden { display: none; }

.storage-health-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.86rem;
}

.storage-health-row strong { font-weight: 600; }

.storage-health-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.storage-health-actions.hidden { display: none; }

.storage-health-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
}

.storage-health-option input[type="checkbox"] {
  accent-color: var(--primary, #6366f1);
}

.precheck-catalog-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.precheck-catalog-modal-card {
  width: min(900px, 96vw);
}

.precheck-catalog-modal-body {
  display: grid;
  gap: 0.8rem;
}

.precheck-catalog-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.precheck-catalog-section {
  display: grid;
  gap: 0.45rem;
}

.precheck-catalog-section h4 {
  margin: 0;
  font-size: 0.86rem;
}

.precheck-catalog-detail-modal-card {
  width: min(900px, 96vw);
}

.precheck-catalog-detail-state {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  background: color-mix(in srgb, var(--surface) 96%, #ffffff 4%);
}

.precheck-catalog-detail-state.is-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
}

.precheck-catalog-detailed-body {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: color-mix(in srgb, var(--surface) 96%, #ffffff 4%);
  max-height: min(62vh, 700px);
  overflow: auto;
  line-height: 1.55;
  white-space: normal;
}

.precheck-catalog-detailed-body p {
  margin: 0 0 0.7rem;
}

.precheck-catalog-detailed-body ul {
  margin: 0 0 0.7rem;
  padding-left: 1.1rem;
}

.precheck-catalog-mail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.precheck-catalog-questions-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.28rem;
  max-height: 220px;
  overflow: auto;
}

.ai-analysis-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
}

.ai-analysis-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-ring);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: aiSpin 700ms linear infinite;
}

@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   24. TASK ITEMS
   -------------------------------------------------------------------------- */

.task-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.56rem;
  background: var(--surface);
  display: grid;
  gap: 0.26rem;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), border-color 200ms var(--ease-out);
}

.task-item:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-hover);
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.task-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

.task-sub {
  margin: 0.15rem 0 0;
  font-size: 0.73rem;
  color: var(--muted);
}

.task-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

/* --------------------------------------------------------------------------
   25. BADGES
   -------------------------------------------------------------------------- */

.badge {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.42rem;
  color: var(--muted);
}

.badge-source-system {
  background: #f0f1f3;
  color: #4b5563;
  border-color: #e5e7eb;
}

.badge-source-user {
  background: #ecfdf5;
  color: #059669;
  border-color: rgba(34, 197, 94, 0.15);
}

.badge-source-ai {
  background: #eef2ff;
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.15);
}

/* --------------------------------------------------------------------------
   26. OVERFLOW SCROLL CONTAINERS
   -------------------------------------------------------------------------- */

#tasksList,
#activityStream {
  max-height: 52vh;
  overflow: auto;
  padding-right: 0.15rem;
}

#tasksByStage,
#tasksInsights {
  max-height: 24vh;
  overflow: auto;
  padding-right: 0.15rem;
}

/* --------------------------------------------------------------------------
   27. TOOLBAR
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem 0.68rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  min-height: 56px;
}

.search-wrap {
  flex: 1 1 260px;
  min-width: 180px;
  max-width: 360px;
  border: 1px solid color-mix(in srgb, var(--line) 85%, var(--surface) 15%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 76%, var(--surface) 24%);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.search-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-ring) 70%, transparent 30%);
}

.search-wrap input {
  width: 100%;
  border: 0;
  background: transparent;
  min-height: 36px;
  padding: 0 0.72rem;
  color: var(--ink);
  font-size: 0.86rem;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-wrap input:focus {
  outline: none;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0.3rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--line);
}

.toolbar-left-controls {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.toolbar-right-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.toolbar-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 36px;
  min-height: 36px;
  border-radius: 10px;
  padding: 0 0.68rem;
  font-size: 0.82rem;
  white-space: nowrap;
  line-height: 1;
}

.toolbar-select {
  padding-right: 0.55rem;
}

.toolbar-select .toolbar-select-text {
  font-weight: 600;
  color: var(--muted);
}

.toolbar-select .toolbar-select-text strong {
  color: var(--ink);
  font-weight: 700;
  margin-left: 0.15rem;
}

.toolbar-select .btn-caret {
  color: var(--muted);
  font-size: 0.75rem;
  margin-left: 0.1rem;
  line-height: 1;
}

.toolbar-select:hover .btn-caret,
.toolbar-select:hover .toolbar-select-text,
.toolbar-select:hover .toolbar-select-text strong {
  color: var(--primary);
}

.toolbar-toggle .toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.5;
  transition: background-color 200ms var(--ease-out), opacity 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.toolbar-toggle[aria-pressed="true"] .toggle-dot {
  background: #10b981;
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.toolbar-toggle[aria-pressed="true"] .toolbar-select-text strong {
  color: #10b981;
}

.toolbar-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0 0.6rem;
  white-space: nowrap;
  line-height: 1;
}

.toolbar-icon-cluster {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  padding: 0.22rem 0.28rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 80%, var(--panel) 20%);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  flex: 0 0 auto;
}

.toolbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 200ms var(--ease-out), background-color 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.toolbar-icon-btn:hover {
  transform: translateY(-1px);
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

.toolbar-icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notif-btn::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: notifPulse 2s infinite;
  opacity: 0;
  pointer-events: none;
}

.notif-btn.has-unread::after {
  opacity: 1;
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.notif-badge.hidden {
  display: none;
}

.notif-wrap {
  position: relative;
}

.notif-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 86vw);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-elevated);
  z-index: 95;
  overflow: hidden;
  animation: modalEnter 180ms var(--ease-spring);
}

.notif-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.83rem;
}

.notif-menu-action {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.28rem;
}

.notif-list {
  max-height: 320px;
  overflow: auto;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.notif-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 0.55rem 0.62rem;
  cursor: pointer;
  display: grid;
  gap: 0.22rem;
}

.notif-item:hover {
  border-color: var(--primary);
}

.notif-item-title {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--ink);
}

.notif-item-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.notif-empty {
  margin: 0;
  padding: 0.8rem;
  font-size: 0.78rem;
  color: var(--muted);
}

@keyframes notifPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* --------------------------------------------------------------------------
   28. PROFILE DROPDOWN
   -------------------------------------------------------------------------- */

.profile-wrap {
  position: relative;
}

.profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid rgba(99, 102, 241, 0.3);
  padding: 0;
  overflow: hidden;
  background: var(--primary-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.profile-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-elevated);
  padding: 0.62rem;
  z-index: 90;
  animation: modalEnter 180ms var(--ease-spring);
}

.profile-name {
  margin: 0;
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--ink);
}

.profile-role {
  margin: 0.12rem 0 0.48rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.profile-logout {
  width: 100%;
}

/* --------------------------------------------------------------------------
   29. BUTTONS
   -------------------------------------------------------------------------- */

.btn {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.52rem 0.9rem;
  font-weight: 650;
  font-size: 0.84rem;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: transform 200ms var(--ease-out),
              box-shadow 200ms var(--ease-out),
              background-color 200ms var(--ease-out),
              border-color 200ms var(--ease-out),
              color 200ms var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.09);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-dark {
  background: color-mix(in srgb, var(--ink) 92%, var(--surface) 8%);
  color: #f8fafc;
  border-color: color-mix(in srgb, var(--ink) 78%, var(--line) 22%);
}

.btn-dark:hover {
  background: color-mix(in srgb, var(--ink) 84%, var(--surface) 16%);
}

.btn-ghost {
  background: color-mix(in srgb, var(--surface) 80%, var(--panel) 20%);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--line) 86%, var(--surface) 14%);
}

.btn-ghost:hover {
  background: color-mix(in srgb, var(--panel) 70%, var(--surface) 30%);
  border-color: color-mix(in srgb, var(--line) 60%, var(--primary) 40%);
}

.btn-icon {
  margin-right: 0.28rem;
  font-size: 0.84rem;
}

.btn-small {
  min-height: 34px;
  padding: 0.36rem 0.7rem;
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   30. KPI BAND (Board View)
   -------------------------------------------------------------------------- */

.kpi-band {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.kpi-band-slim {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--shadow);
  transition: box-shadow 300ms var(--ease-out);
}

.kpi-band-slim .kpi-card {
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 56px;
}

.kpi-card:hover {
  box-shadow: var(--shadow-hover);
}

.kpi-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  color: var(--ink);
}

.bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 0.4rem;
  min-height: 86px;
}

.bar-col {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
}

.bar-stick {
  width: 24px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
}

.bar-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.kpi-metric {
  display: grid;
  align-content: center;
}

.kpi-band-slim .kpi-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.kpi-band-slim .kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.kpi-value {
  margin: 0.2rem 0 0;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.kpi-band-slim .kpi-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   31. BOARD HEAD & KANBAN
   -------------------------------------------------------------------------- */

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.2rem 0.2rem;
}

.board-head h1 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.03em;
  font-size: 1.8rem;
  color: var(--ink);
}

.count-pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.26rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.count-pill.subtle {
  background: var(--panel);
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  overflow-x: visible;
  padding-bottom: 0.35rem;
}

.column {
  background: color-mix(in srgb, var(--panel) 72%, var(--surface) 28%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.52rem;
  min-height: 320px;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.44rem;
}

.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.column-head-main {
  min-width: 0;
}

.column-title {
  margin: 0;
  font-size: 0.99rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
  color: var(--ink);
  min-width: 0;
}

.column-title-wrap {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.42rem;
  min-width: 0;
}

.column-title-wrap > span:last-child {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.stage-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.12);
  font-size: 0.96rem;
  line-height: 1;
}

.stage-1 {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.12);
}

.stage-2 {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.12);
}

.stage-3 {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.12);
}

.stage-4 {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.stage-5 {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.12);
}

.column-count {
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 84%, var(--panel) 16%);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  color: var(--muted);
}

.column-head-side {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
}

.stage-search-toggle {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--panel) 10%);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.stage-search-toggle:hover,
.stage-search-toggle:focus-visible,
.stage-search-toggle.is-open {
  background: color-mix(in srgb, var(--primary) 11%, var(--surface) 89%);
  border-color: color-mix(in srgb, var(--primary) 52%, var(--line) 48%);
  color: var(--ink);
  outline: none;
}

.stage-search-wrap {
  display: block;
  margin-top: -0.02rem;
}

.stage-search-input {
  width: 100%;
  height: 31px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--panel) 10%);
  color: var(--ink);
  font-size: 0.79rem;
  padding: 0 0.6rem;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.stage-search-input:focus {
  border-color: color-mix(in srgb, var(--primary) 72%, var(--line) 28%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent 84%);
}

@media (max-width: 1500px) {
  .kanban-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1220px) {
  .kanban-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .kanban-board {
    grid-template-columns: minmax(0, 1fr);
  }
}

.column-body {
  display: grid;
  gap: 0.46rem;
  align-content: start;
  max-height: min(68vh, 860px);
  overflow-y: auto;
  padding-right: 0.1rem;
}

.board-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  margin-top: 0.4rem;
  padding: 0.35rem 0.55rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.board-load-more:hover {
  background: color-mix(in srgb, var(--panel) 60%, var(--surface) 40%);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--line) 40%, var(--primary) 60%);
  border-style: solid;
}

.board-load-more.is-collapse {
  border-style: solid;
  border-color: var(--line);
  color: var(--muted);
}

.board-load-more.is-collapse:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--line) 60%, var(--ink) 40%);
}

/* --------------------------------------------------------------------------
   32. LEAD CARDS
   -------------------------------------------------------------------------- */

.lead-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 88%, var(--surface) 12%);
  border-radius: 12px;
  padding: 0.62rem;
  display: grid;
  gap: 0.42rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: border-color 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
}

.lead-card:hover {
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.lead-card.card-tilt {
  transform: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.lead-card.is-selected {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface) 92%);
  border-color: var(--primary);
  border-left: 2px solid var(--primary);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.11);
}

.lead-card.is-new {
  background: color-mix(in srgb, #eff6ff 45%, var(--surface) 55%);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.08);
}

.lead-card.is-selected .meta-muted,
.lead-card.is-selected .mini-row,
.lead-card.is-selected .card-sub {
  color: var(--muted);
}

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

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.card-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ink);
}

.card-sub {
  color: var(--muted);
  font-size: 0.81rem;
}

.card-menu {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
  transition: color 200ms var(--ease-out);
}

.card-menu:hover {
  color: var(--primary);
}

.lead-card.is-selected .card-menu {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   33. STATUS TAGS
   -------------------------------------------------------------------------- */

.status-tag {
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-open {
  background: #ecfdf5;
  color: #059669;
  border-color: rgba(34, 197, 94, 0.2);
}

.status-new {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.35);
}

.status-blocked {
  background: #fef2f2;
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

.status-done {
  background: #eef2ff;
  color: #4f46e5;
  border-color: rgba(99, 102, 241, 0.2);
}

/* --------------------------------------------------------------------------
   34. MINI GRID & META
   -------------------------------------------------------------------------- */

.mini-grid {
  display: grid;
  gap: 0.3rem;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-size: 0.8rem;
}

.meta-muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.meta-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.due-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.22rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink);
  background: var(--panel);
}

.lead-card.is-selected .due-chip {
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.05);
  color: var(--primary);
}

.meta-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.lead-card.is-selected .meta-icons {
  color: var(--primary);
}

.card-actions {
  display: flex;
  gap: 0.45rem;
}

.card-actions .btn {
  min-height: 38px;
  padding: 0.38rem 0.65rem;
  font-size: 0.82rem;
}

.card-actions-inline {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.btn-archive-icon {
  min-width: 36px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  border-color: rgba(239, 68, 68, 0.28);
  color: rgba(185, 28, 28, 0.88);
  background: rgba(239, 68, 68, 0.04);
}

.btn-archive-icon:hover {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.1);
}

/* --------------------------------------------------------------------------
   35. DETAIL PANEL
   -------------------------------------------------------------------------- */

.detail-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.detail-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-archive {
  min-height: 36px;
  padding: 0.28rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 650;
  border-radius: 10px;
  border-color: rgba(239, 68, 68, 0.28);
  color: rgba(185, 28, 28, 0.92);
  background: rgba(239, 68, 68, 0.04);
}

.btn-archive:hover {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.09);
}

.detail-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
}

.hidden {
  display: none;
}

/* --------------------------------------------------------------------------
   36. MODALS
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 1rem;
}

.modal-card {
  width: min(640px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-elevated);
  padding: 1.2rem;
  animation: modalEnter 250ms var(--ease-spring);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.modal-head h3 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-backdrop.hidden {
  display: none;
}

.precheck-modal-shell {
  width: min(1080px, 96vw);
  max-height: min(90vh, 960px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.precheck-modal-shell .modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.precheck-modal-body {
  min-height: 0;
  overflow-y: auto;
  padding-top: 0.75rem;
}

.precheck-loading {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, #ffffff 4%);
  padding: 1rem;
}

.precheck-loading.hidden {
  display: none !important;
}

.precheck-loading-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.precheck-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(129, 140, 248, 0.25);
  border-top-color: var(--accent);
  animation: precheckSpin 900ms linear infinite;
}

@keyframes precheckSpin {
  to {
    transform: rotate(360deg);
  }
}

.precheck-result-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 0.8rem;
}

.precheck-result-grid.hidden {
  display: none !important;
}

.precheck-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.precheck-result-kicker {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.precheck-result-meta {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
}

.precheck-result-pane {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, #ffffff 4%);
  padding: 0.75rem;
}

.precheck-result-pane h4 {
  margin: 0 0 0.45rem;
}

.precheck-pane-left {
  display: grid;
  gap: 0.55rem;
  align-content: start;
  min-height: 0;
}

.precheck-pane-right {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-height: 0;
}

.precheck-left-actions {
  margin-top: 0.3rem;
  display: flex;
  justify-content: flex-start;
}

.precheck-email-subject {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  color: var(--ink);
  font: 600 0.8rem/1.4 'Inter', sans-serif;
}

.precheck-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  background: rgba(129, 140, 248, 0.2);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  margin: 0 0 0.55rem;
}

.precheck-status-pill.is-success {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.precheck-status-pill.is-warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.5);
  color: #7a4a00;
}

.precheck-status-pill.is-error {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

.precheck-findings-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
  max-height: 260px;
  overflow: hidden;
}

.precheck-checks-title {
  margin: 1rem 0 0.45rem;
}

.precheck-checks-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
  max-height: 180px;
  overflow: hidden;
}

.precheck-email-preview {
  width: 100%;
  min-height: 220px;
  max-height: 44vh;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  background: color-mix(in srgb, var(--surface) 86%, var(--panel) 14%);
  color: var(--ink);
  font: 500 0.8rem/1.5 'Inter', sans-serif;
}

.precheck-actions {
  margin-top: 0.25rem;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.precheck-toolbar-icons {
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--surface) 92%, #ffffff 8%);
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}

.precheck-toolbar-icons .icon-action-btn.primary {
  color: #fff;
  background: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 72%, var(--line) 28%);
}

.precheck-toolbar-icons .icon-action-btn.primary:hover,
.precheck-toolbar-icons .icon-action-btn.primary:focus-visible {
  background: color-mix(in srgb, var(--ink) 88%, #ffffff 12%);
}

@media (max-width: 980px) {
  .precheck-result-grid {
    grid-template-columns: 1fr;
  }

  .precheck-modal-shell {
    max-height: 92vh;
  }

  .precheck-email-preview {
    max-height: 36vh;
  }
}

/* --------------------------------------------------------------------------
   37. LOGIN MODAL (Dark Dramatic)
   -------------------------------------------------------------------------- */

.login-backdrop {
  background: #09090b;
  overflow: hidden;
}

.login-smoke-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.login-smoke-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(9, 9, 11, 0.4) 60%, rgba(9, 9, 11, 0.75) 100%);
  pointer-events: none;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(12, 12, 22, 0.75) 0%, rgba(6, 6, 14, 0.82) 100%);
  color: #f8f8ff;
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 26px 58px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
  transition: transform 250ms var(--ease-spring), box-shadow 250ms var(--ease-spring), border-color 250ms var(--ease-spring);
}

.login-card.tilt-active {
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 30px 64px rgba(0, 0, 0, 0.56);
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
  opacity: 0.55;
}

.login-logo {
  max-width: 220px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.login-card h2 {
  margin: 0;
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.login-subtitle {
  margin: 0.35rem 0 1rem;
  text-align: center;
  color: rgba(235, 235, 255, 0.65);
  font-size: 0.84rem;
}

.login-form {
  display: grid;
  gap: 0.5rem;
}

.login-form label {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(248, 248, 255, 0.85);
}

.login-form input {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 0.5rem 0.62rem;
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.login-form input::placeholder {
  color: rgba(225, 225, 246, 0.35);
}

.login-form input:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap input {
  padding-right: 72px;
}

.login-eye-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  min-height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.3rem 0.58rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-eye-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.18rem;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  color: rgba(238, 238, 255, 0.65);
  font-size: 0.77rem;
}

.login-remember input {
  width: 14px;
  height: 14px;
  min-height: 14px;
}

.login-link {
  font-size: 0.77rem;
  color: rgba(238, 238, 255, 0.65);
  cursor: pointer;
  transition: color 200ms var(--ease-out);
}

.login-link:hover {
  color: var(--primary-light);
}

.login-submit {
  margin-top: 0.42rem;
  min-height: 42px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-weight: 700;
}

.login-submit:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.login-status {
  margin: 0.5rem 0 0;
  text-align: center;
  color: rgba(229, 229, 255, 0.6);
}

/* --------------------------------------------------------------------------
   38. EMPTY STATE
   -------------------------------------------------------------------------- */

.empty-state {
  margin-top: 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   39. DETAIL GRID & CARDS
   -------------------------------------------------------------------------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.65rem;
}

.detail-shell {
  margin-top: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.3rem;
  background: color-mix(in srgb, var(--panel) 74%, var(--surface) 26%);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.detail-tab {
  flex: 0 1 auto;
  height: 38px;
  padding: 0 0.9rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.detail-tab:hover {
  background: var(--surface);
  color: var(--ink);
}

.detail-tab.is-active {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface) 86%);
  color: color-mix(in srgb, var(--primary) 72%, #0f172a 28%);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line) 66%);
  box-shadow: none;
}

.detail-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.detail-panel {
  display: none;
  flex-direction: column;
  gap: 0.6rem;
}

.detail-panel.is-active {
  display: flex;
  animation: detailPanelFade 180ms var(--ease-out);
}

.detail-panel-grid.is-active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

@keyframes detailPanelFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 780px) {
  .detail-panel-grid.is-active {
    grid-template-columns: 1fr;
  }

  .detail-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .btn-archive {
    margin-left: auto;
  }
}

.detail-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 62%, var(--surface) 38%);
  border-radius: 12px;
  padding: 0.78rem;
}

.detail-card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.detail-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.detail-card-full {
  grid-column: span 2;
}

/* --------------------------------------------------------------------------
   40. KEY-VALUE GRID
   -------------------------------------------------------------------------- */

.kv-grid {
  display: grid;
  gap: 0.35rem;
}

.kv-item {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 0.3rem;
  font-size: 0.88rem;
}

.kv-item span {
  color: var(--muted);
}

.lead-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.lead-overview-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: color-mix(in srgb, var(--panel) 78%, var(--surface) 22%);
}

.lead-overview-card h4 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.lead-overview-card .kv-grid {
  gap: 0.3rem;
}

.lead-overview-card .kv-item {
  align-items: center;
  padding-bottom: 0.22rem;
}

.lead-overview-card .kv-item strong {
  font-weight: 600;
  text-align: right;
}

.lead-overview-card-wide {
  grid-column: 1 / -1;
}

.lead-readiness-grid {
  display: grid;
  gap: 0.28rem;
}

.lead-readiness-row {
  display: grid;
  grid-template-columns: 24px minmax(160px, 220px) minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0;
  border-bottom: 1px dashed var(--line);
}

.lead-readiness-row:last-child {
  border-bottom: 0;
}

.lead-readiness-icon {
  font-size: 0.9rem;
  opacity: 0.86;
}

.lead-readiness-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.lead-readiness-detail {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.lead-readiness-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.16rem 0.56rem;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid var(--line);
}

.lead-readiness-chip.is-ok {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: #0f766e;
}

.lead-readiness-chip.is-warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  color: #92400e;
}

.lead-readiness-chip.is-open {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.35);
  color: #4338ca;
}

.lead-readiness-chip.is-progress {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.4);
  color: #0369a1;
}

.lead-meta-mail {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 52%, transparent);
}

.lead-meta-mail:hover,
.lead-meta-mail:focus-visible {
  color: color-mix(in srgb, var(--primary) 72%, white 28%);
  border-bottom-color: color-mix(in srgb, var(--primary) 80%, transparent);
}

@media (max-width: 860px) {
  .lead-overview-grid {
    grid-template-columns: 1fr;
  }

  .lead-overview-card-wide {
    grid-column: auto;
  }

  .lead-readiness-row {
    grid-template-columns: 20px minmax(120px, 180px) minmax(0, 1fr) auto;
  }

  .lead-readiness-row .btn {
    grid-column: 2 / -1;
    justify-self: start;
    margin-top: 0.1rem;
  }
}

.automation-status-card {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, var(--surface) 92%), transparent);
}

.automation-status-card h4 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.automation-status-grid {
  display: grid;
  gap: 0.35rem;
}

.automation-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
}

.automation-status-row span {
  color: var(--muted);
}

.automation-status-row strong {
  color: var(--text);
}

.automation-catalog-wrap {
  margin-top: 0.55rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}

.automation-catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.4rem;
}

.automation-catalog-head strong {
  font-size: 0.78rem;
}

.automation-catalog-head .btn {
  min-height: 28px;
  padding: 0.25rem 0.5rem;
  font-size: 0.74rem;
}

.automation-catalog-text {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 19, 36, 0.85);
  color: var(--text);
  padding: 0.5rem;
  font: 500 0.76rem/1.45 'Inter', sans-serif;
}

/* --------------------------------------------------------------------------
   41. CHECKLIST
   -------------------------------------------------------------------------- */

.checklist {
  display: grid;
  gap: 0.55rem;
}

.checklist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.checklist-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.checklist-toolbar .btn {
  min-height: 30px;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.checklist-groups {
  display: grid;
  gap: 0.55rem;
}

.checklist-help {
  margin: 0.35rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.stage1-doc-upload {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  margin: 0.35rem 0 0.6rem;
  background: color-mix(in srgb, var(--surface) 84%, var(--panel) 16%);
}

.stage1-doc-upload-title {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.stage1-doc-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.stage1-doc-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.stage1-doc-name {
  margin: 0 0 0.22rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.stage1-doc-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.stage1-doc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.check-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 82%, var(--panel) 18%);
  overflow: hidden;
}

.check-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, var(--surface) 18%);
}

.check-group-head h4 {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.check-group-rows {
  display: grid;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  min-height: 46px;
  transition: background 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.check-item:last-child {
  border-bottom: 0;
}

.check-item:hover {
  background: color-mix(in srgb, var(--panel) 84%, var(--surface) 16%);
}

.check-item.is-selected {
  background: color-mix(in srgb, var(--sidebar-active) 52%, var(--surface) 48%);
}

.check-item.status-done {
  border-left: 2px solid rgba(34, 197, 94, 0.45);
}

.check-item.status-blocked {
  border-left: 2px solid rgba(245, 158, 11, 0.6);
}

.check-item.status-todo {
  border-left: 2px solid color-mix(in srgb, var(--line) 82%, var(--surface) 18%);
}

.check-item.is-system {
  background: color-mix(in srgb, var(--surface) 90%, var(--panel) 10%);
}

.check-select-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.js-check-select {
  width: 16px;
  height: 16px;
  accent-color: #4f46e5;
  cursor: pointer;
}

.check-toggle {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.check-main {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  gap: 0.08rem;
  flex: 1;
  min-width: 0;
  padding: 0;
  cursor: pointer;
}

.check-main:disabled {
  opacity: 1;
  cursor: default;
}

.check-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-key {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-status-chip {
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.16rem 0.45rem;
  letter-spacing: 0.01em;
}

.check-toggle-system {
  opacity: 0.85;
  cursor: default;
  font-size: 0.82rem;
}

.check-system-note {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.check-system-badge {
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.14rem 0.42rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 72%, var(--surface) 28%);
}

.chip-done {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(5, 150, 105, 0.1);
}

.chip-blocked {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.chip-todo {
  color: var(--muted);
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 78%, var(--panel) 22%);
}

.compact-scroll {
  max-height: 260px;
  overflow: auto;
  padding-right: 0.1rem;
}

.task-exec-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.task-filter-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.26rem 0.56rem;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color 180ms var(--ease-out), color 180ms var(--ease-out), background 180ms var(--ease-out);
}

.task-filter-chip:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--line) 65%, var(--primary) 35%);
}

.task-filter-chip.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface) 90%);
}

.task-exec-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.52rem 0.56rem;
  display: grid;
  gap: 0.4rem;
}

.task-exec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.task-exec-main {
  min-width: 0;
}

.task-exec-main .activity-title,
.task-exec-main .activity-sub {
  margin: 0;
}

.task-exec-head .meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.task-exec-controls {
  display: grid;
  grid-template-columns: 1.1fr minmax(140px, 180px) auto auto;
  gap: 0.42rem;
  align-items: center;
}

.task-exec-controls input,
.task-exec-controls select {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.34rem 0.5rem;
  color: var(--ink);
}

.task-exec-controls input:focus,
.task-exec-controls select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.task-status-pending {
  border-left: 3px solid #94a3b8;
}

.task-status-in_progress {
  border-left: 3px solid #2563eb;
}

.task-status-in_review {
  border-left: 3px solid #f59e0b;
}

.task-status-done {
  border-left: 3px solid #16a34a;
}

.task-status-blocked {
  border-left: 3px solid #dc2626;
}

/* --------------------------------------------------------------------------
   42. FORM GRID
   -------------------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.form-grid label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.inline-label {
  grid-column: span 2;
  grid-template-columns: auto 1fr;
  align-items: center;
  font-weight: 600;
}

.form-grid input,
.form-grid select {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.4rem 0.55rem;
  color: var(--ink);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-grid button {
  grid-column: span 2;
}

/* --------------------------------------------------------------------------
   43. OVERFLOW CONTAINERS (Compliance, Matching, etc.)
   -------------------------------------------------------------------------- */

#complianceFindings,
#matchingQueue,
#matchingRecommendations,
#timelineEvents,
#adminAuditEvents,
#opsErrorCenter {
  max-height: 50vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.compliance-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 0.85rem;
  align-items: start;
}

.compliance-findings-card {
  min-height: 620px;
}

.compliance-side-stack {
  display: grid;
  gap: 0.85rem;
}

.compliance-side-stack .widget {
  min-height: 300px;
}

.compliance-kpis .report-kpi .kpi-value {
  letter-spacing: -0.02em;
}

.compliance-quick-entry {
  margin-top: 0.85rem;
}

.projects-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 0.85rem;
  align-items: start;
}

.projects-main-card,
.matching-main-card {
  min-height: 620px;
}

.projects-side-stack,
.matching-side-stack {
  display: grid;
  gap: 0.85rem;
}

.projects-side-stack .widget {
  min-height: 210px;
}

.matching-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 0.85rem;
  align-items: start;
}

.matching-primary,
.matching-sidebar {
  display: grid;
  gap: 0.85rem;
}

.matching-quick-core,
.matching-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.matching-advanced-fields {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.matching-quick-entry select,
.matching-quick-entry input {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, var(--primary) 18%);
  background: color-mix(in srgb, var(--surface) 88%, var(--panel) 12%);
  padding: 0.5rem 0.75rem;
  color: var(--ink);
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out), background-color 200ms var(--ease-out);
}

.matching-quick-entry select {
  padding-right: 2rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.matching-quick-entry input:focus,
.matching-quick-entry select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  background: var(--surface);
}

.matching-inline-actions {
  margin-top: 0.5rem;
}

.matching-quick-entry .btn {
  border-radius: 12px;
}

.matching-quick-entry {
  margin-top: 0;
}

.matching-pipeline-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.matching-stage-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.55rem;
}

.matching-stage-label {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.matching-stage-value {
  margin: 0.1rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.matching-stage-rate {
  margin: 0.08rem 0 0;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.matching-mini-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.matching-mini-kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.5rem;
}

.matching-mini-kpi p {
  margin: 0;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.matching-mini-kpi strong {
  display: block;
  margin-top: 0.18rem;
  font-size: 1rem;
  color: var(--ink);
}

.matching-feed-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.58rem;
  display: grid;
  gap: 0.3rem;
}

.matching-feed-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.82rem;
}

.matching-feed-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.matching-feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.matching-v2-primary .widget,
.matching-v2-sidebar .widget {
  min-height: 0;
}

.matching-v2-snapshot {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.42rem;
}

.matching-snapshot-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.52rem 0.65rem;
}

.matching-snapshot-row span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.matching-snapshot-row strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.matching-v2-actions {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.42rem;
}

.timeline-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 0.85rem;
  align-items: start;
}

.timeline-main-card {
  min-height: 620px;
}

.timeline-side-stack {
  display: grid;
  gap: 0.85rem;
}

.timeline-side-stack .widget {
  min-height: 250px;
}

.reporting-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 0.85rem;
  align-items: start;
}

.reporting-main-card {
  min-height: 420px;
}

.reporting-side-stack {
  display: grid;
  gap: 0.85rem;
}

.reporting-side-stack .widget {
  min-height: 205px;
}

.reporting-secondary-grid {
  margin-top: 0.85rem;
}

#complianceDocCoverage,
#matchingCoverage,
#timelineLeadMeta,
#reportingBlockerTrend,
#reportingBlockerCauses,
#opsHealth,
#opsQueue {
  max-height: 42vh;
  overflow: auto;
  padding-right: 0.15rem;
}

#opsIngestionAlerts {
  max-height: 48vh;
  overflow: auto;
  padding-right: 0.15rem;
}

.ops-grid-modern {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.ops-head {
  align-items: center;
}

.ops-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ops-card {
  min-height: 560px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, #9ca3af 24%);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 44%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #f8fafc 8%), var(--surface));
}

.ops-card .widget-head {
  align-items: center;
}

.ops-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16), 0 0 18px rgba(34, 197, 94, 0.35);
  animation: opsPulse 2s ease-in-out infinite;
}

@keyframes opsPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.14); opacity: 0.7; }
}

.ops-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.ops-last-updated {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
}

.ops-kpi-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--surface) 90%, #ffffff 10%);
}

.ops-kpi-item .kpi-label {
  margin: 0;
  font-size: 0.78rem;
}

.ops-kpi-item .kpi-value {
  margin: 0.18rem 0 0;
  font-size: 1.5rem;
  line-height: 1;
}

.ops-actions-compact {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.ops-actions-compact input,
.ops-actions-compact select,
.ops-actions-compact button {
  min-height: 40px;
}

.ops-actions-compact button {
  grid-column: span 2;
}

.ops-health-list {
  max-height: 220px;
  overflow: auto;
}

.ops-card-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.ops-card-signals #opsQueue {
  margin-bottom: 0.5rem;
}

.ops-trend-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 0.2rem;
  align-items: end;
  height: 86px;
  margin: 0.2rem 0 0.65rem;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 93%, #f8fafc 7%);
}

.ops-trend-bar {
  min-height: 4px;
  border-radius: 6px;
  background: linear-gradient(180deg, #8b9fff 0%, #667eea 100%);
  box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.14);
}

.ops-modal-card {
  width: min(560px, 96vw);
}

.ops-modal-card textarea,
.ops-modal-card input,
.ops-modal-card select {
  width: 100%;
}

#opsIngestionAlerts .activity-item:has(.badge.status-blocked) {
  border-color: color-mix(in srgb, #ef4444 44%, var(--line) 56%);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.18), 0 0 18px rgba(239, 68, 68, 0.12);
}

#opsIngestionAlerts .activity-item:has(.badge.status-open) {
  border-color: color-mix(in srgb, #f59e0b 40%, var(--line) 60%);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.16);
}

@media (max-width: 1180px) {
  .compliance-main-grid {
    grid-template-columns: 1fr;
  }

  .projects-main-grid,
  .matching-shell,
  .reporting-main-grid,
  .timeline-main-grid,
  .ops-grid-modern {
    grid-template-columns: 1fr;
  }

  .compliance-findings-card,
  .compliance-side-stack .widget,
  .projects-main-card,
  .matching-main-card,
  .reporting-main-card,
  .timeline-main-card,
  .projects-side-stack .widget,
  .matching-side-stack .widget,
  .reporting-side-stack .widget,
  .timeline-side-stack .widget,
  .ops-card {
    min-height: 0;
  }

  .ops-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .matching-quick-core,
  .matching-inline-actions,
  .matching-advanced-fields {
    grid-template-columns: 1fr;
  }

  .matching-pipeline-bar {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   44. TRANSITION HINTS
   -------------------------------------------------------------------------- */

.transition-hint {
  margin-top: 0.55rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--panel) 10%);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-size: 0.84rem;
  color: var(--ink);
}

.stage-transition-actions {
  margin-top: 0.65rem;
  display: flex;
  justify-content: flex-start;
}

.transition-hint.ok {
  border-color: color-mix(in srgb, #22c55e 30%, var(--line) 70%);
  background: color-mix(in srgb, #22c55e 6%, var(--surface) 94%);
}

.transition-hint.warn {
  border-color: color-mix(in srgb, #f59e0b 32%, var(--line) 68%);
  background: color-mix(in srgb, #f59e0b 6%, var(--surface) 94%);
}

.transition-hint.danger {
  border-color: color-mix(in srgb, #ef4444 32%, var(--line) 68%);
  background: color-mix(in srgb, #ef4444 6%, var(--surface) 94%);
}

.gate-hint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.gate-hint-copy {
  margin: 0 0 0.65rem;
  color: var(--muted);
  opacity: 1;
}

.gate-inline-list {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.transition-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.transition-list {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.transition-list h4 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.transition-list ul {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.28rem;
}

.transition-list li {
  color: var(--ink);
}

.transition-list.fulfilled ul {
  list-style: none;
  padding-left: 0;
}

.transition-list.fulfilled li {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.transition-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-top: 0.02rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #22c55e 32%, var(--line) 68%);
  background: color-mix(in srgb, #22c55e 8%, transparent);
  color: color-mix(in srgb, #16a34a 76%, var(--ink) 24%);
  font-size: 0.68rem;
  line-height: 1;
}

.linklike {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, var(--panel) 8%);
  color: var(--ink);
  padding: 0.18rem 0.45rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  border-radius: 8px;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.linklike:hover,
.linklike:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 44%, var(--line) 56%);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface) 90%);
  color: var(--ink);
}

.transition-status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.transition-status-chip.is-ok {
  border-color: color-mix(in srgb, #22c55e 34%, var(--line) 66%);
  background: color-mix(in srgb, #22c55e 10%, transparent);
  color: color-mix(in srgb, #166534 72%, var(--ink) 28%);
}

.transition-status-chip.is-warn {
  border-color: color-mix(in srgb, #f59e0b 34%, var(--line) 66%);
  background: color-mix(in srgb, #f59e0b 10%, transparent);
  color: #7a4a00;
}

.transition-status-chip.is-error {
  border-color: color-mix(in srgb, #ef4444 34%, var(--line) 66%);
  background: color-mix(in srgb, #ef4444 10%, transparent);
  color: color-mix(in srgb, #991b1b 74%, var(--ink) 26%);
}

.transition-result-box {
  white-space: pre-wrap;
}

.stage1-doc-row .check-main-static {
  cursor: default;
}

.stage1-doc-meta {
  color: var(--muted);
  font-size: 0.74rem;
}

.stage1-doc-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

@media (max-width: 980px) {
  .transition-lists {
    grid-template-columns: 1fr;
  }
}

.gate-inline-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid currentColor;
  padding: 0.22rem 0.55rem;
  font-size: 0.73rem;
  line-height: 1.2;
}

.gate-blocker-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.gate-block-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: color-mix(in srgb, var(--surface) 94%, var(--panel) 6%);
  box-shadow: var(--shadow);
}

.gate-block-card.priority-hoch {
  border-color: color-mix(in srgb, #dc2626 42%, var(--line) 58%);
  background: color-mix(in srgb, #dc2626 6%, var(--surface) 94%);
}

.gate-block-card.priority-mittel {
  border-color: color-mix(in srgb, #d97706 40%, var(--line) 60%);
  background: color-mix(in srgb, #d97706 6%, var(--surface) 94%);
}

.gate-block-card.priority-niedrig {
  border-color: color-mix(in srgb, #2563eb 38%, var(--line) 62%);
  background: color-mix(in srgb, #2563eb 5%, var(--surface) 95%);
}

.gate-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.gate-block-head h5 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: inherit;
}

.gate-priority-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  font-weight: 700;
}

.gate-priority-pill.hoch {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(239, 68, 68, 0.13);
}

.gate-priority-pill.mittel {
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.38);
  background: rgba(245, 158, 11, 0.12);
}

.gate-priority-pill.niedrig {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.36);
  background: rgba(59, 130, 246, 0.12);
}

.gate-block-text {
  margin: 0 0 0.45rem;
  font-size: 0.77rem;
  line-height: 1.35;
}

.approval-gate-status {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem;
  margin-bottom: 0.6rem;
  background: color-mix(in srgb, var(--surface) 82%, var(--panel) 18%);
  display: grid;
  gap: 0.5rem;
}

.approval-gate-status.is-ready {
  border-color: rgba(34, 197, 94, 0.35);
  background: color-mix(in srgb, #22c55e 10%, var(--surface) 90%);
}

.approval-gate-status.is-blocked {
  border-color: rgba(239, 68, 68, 0.35);
  background: color-mix(in srgb, #ef4444 9%, var(--surface) 91%);
}

.approval-gate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.approval-gate-kicker {
  margin: 0 0 0.12rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.approval-gate-head h4 {
  margin: 0;
  font-size: 0.88rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.gate-blocker-grid-compact {
  margin-top: 0.15rem;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.gate-blocker-grid-compact .gate-block-card {
  background: color-mix(in srgb, var(--surface) 90%, var(--panel) 10%);
}

[data-theme="dark"] .gate-block-card {
  background: color-mix(in srgb, var(--surface) 86%, var(--panel) 14%);
  border-color: color-mix(in srgb, var(--line) 72%, #ffffff 28%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .gate-priority-pill.hoch {
  color: #ffd4d4;
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(153, 27, 27, 0.34);
}

[data-theme="dark"] .gate-priority-pill.mittel {
  color: #ffe8c0;
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(146, 64, 14, 0.34);
}

[data-theme="dark"] .gate-priority-pill.niedrig {
  color: #d9e9ff;
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(30, 64, 175, 0.34);
}

[data-theme="light"] .gate-block-card {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--line) 82%, #0f172a 18%);
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.07);
}

@media (max-width: 980px) {
  .gate-blocker-grid {
    grid-template-columns: 1fr;
  }
}

.stage-blueprint {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 0.75rem;
}

.stage-blueprint-head h4 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.stage-blueprint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.stage-blueprint-grid section {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: var(--surface);
}

.stage-blueprint-grid section.span-2 {
  grid-column: span 2;
}

.stage-blueprint-grid h5 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.stage-blueprint-grid ul {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.3rem;
}

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

  .stage-blueprint-grid section.span-2 {
    grid-column: span 1;
  }
}

/* --------------------------------------------------------------------------
   45. RESPONSE BOX
   -------------------------------------------------------------------------- */

.response-box {
  margin: 0.6rem 0 0;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  min-height: 42px;
  max-height: none;
  overflow: visible;
  font-size: 0.82rem;
  white-space: normal;
  font-family: 'Manrope', sans-serif;
}

/* --------------------------------------------------------------------------
   46. TOAST
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 100;
  font-size: 0.85rem;
  font-weight: 600;
  animation: toastSlideUp 400ms var(--ease-spring);
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* --------------------------------------------------------------------------
   47. RESPONSIVE - 1100px
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .dash-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-main-grid {
    grid-template-columns: 1fr;
  }

  .dash-panels-grid {
    grid-template-columns: 1fr;
  }

  .tasks-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .reporting-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-span-2 {
    grid-column: span 1;
  }

  .kpi-band {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-band-slim {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi-chart {
    grid-column: span 2;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-card-full {
    grid-column: span 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .task-exec-controls {
    grid-template-columns: 1fr;
  }

  .task-exec-toolbar {
    gap: 0.28rem;
  }

  .task-filter-chip {
    font-size: 0.72rem;
    padding: 0.24rem 0.5rem;
  }

  .check-title {
    white-space: normal;
  }

  .inline-label,
  .form-grid button {
    grid-column: span 1;
  }

  .toolbar-actions {
    flex-wrap: nowrap;
  }

  .toolbar-right-meta {
    margin-left: auto;
  }

  .toolbar-right-meta .toolbar-pill {
    display: none;
  }

  .toolbar-control {
    padding: 0 0.55rem;
    font-size: 0.8rem;
  }

  .toolbar-control .btn-icon {
    margin: 0;
  }
}

/* --------------------------------------------------------------------------
   48. RESPONSIVE - 900px
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.9rem;
  }

  .brand-logo {
    max-width: 340px;
  }

  .brand-logo img {
    filter: brightness(0) invert(1);
  }

  .checklist-toolbar {
    align-items: flex-start;
  }

  .checklist-toolbar-actions {
    width: 100%;
  }

  .checklist-toolbar-actions .btn {
    flex: 1 1 132px;
  }

  .stage1-doc-upload-grid {
    grid-template-columns: 1fr;
  }

  .nav-block {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-foot {
    margin-top: 0;
  }
}

/* --------------------------------------------------------------------------
   49. RESPONSIVE - 640px
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  body {
    padding: 0;
  }

  .app-shell {
    border-radius: 0;
    min-height: 100vh;
  }

  .workspace {
    padding: 0.7rem;
  }

  .brand-logo {
    min-height: 62px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrap {
    min-width: 0;
  }

  .toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .toolbar-left-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .toolbar-left-controls #addCustomerBtn {
    grid-column: span 2;
  }

  .toolbar-right-meta {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar-pill {
    display: none;
  }

  .inline-actions {
    grid-template-columns: 1fr;
  }

  .reporting-kpis {
    grid-template-columns: 1fr;
  }

  .euai-head {
    align-items: flex-start;
  }

  .euai-avatar-wrap {
    width: 78px;
    height: 78px;
  }

  .euai-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-band {
    grid-template-columns: 1fr;
  }

  .kpi-band-slim {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .dash-kpi-row {
    grid-template-columns: 1fr;
  }

  .kpi-chart {
    grid-column: span 1;
  }

  .board-head h1 {
    font-size: 1.35rem;
  }

  .tasks-head h1 {
    font-size: 1.28rem;
  }
}

/* --------------------------------------------------------------------------
   50. REDUCED MOTION
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   DARK MODE OVERRIDES
   -------------------------------------------------------------------------- */

[data-theme="dark"] .widget,
[data-theme="dark"] .dash-card,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .detail-card,
[data-theme="dark"] .detail-wrap,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .report-kpi {
  background: var(--card);
  border-color: var(--line);
}

[data-theme="dark"] .activity-item,
[data-theme="dark"] .task-item,
[data-theme="dark"] .finding-item,
[data-theme="dark"] .reco-row,
[data-theme="dark"] .health-row,
[data-theme="dark"] .check-row {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .search-wrap {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .search-wrap input {
  color: var(--ink);
}

[data-theme="dark"] input,
[data-theme="dark"] select {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--ink);
}

[data-theme="dark"] .toolbar-icon-cluster {
  background: color-mix(in srgb, var(--panel) 82%, var(--surface) 18%);
  border-color: var(--line);
}

[data-theme="dark"] .toolbar-icon-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .toolbar-pill {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .btn-dark {
  background: color-mix(in srgb, var(--primary) 58%, #111827 42%);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line) 50%);
  color: #ffffff;
}

[data-theme="dark"] .btn-ghost {
  background: color-mix(in srgb, var(--panel) 78%, var(--surface) 22%);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .btn-ghost:hover {
  border-color: color-mix(in srgb, var(--line) 58%, var(--primary) 42%);
}

[data-theme="dark"] .btn-archive,
[data-theme="dark"] .btn-archive-icon {
  border-color: rgba(248, 113, 113, 0.3);
  color: rgba(254, 202, 202, 0.92);
  background: rgba(248, 113, 113, 0.1);
}

[data-theme="dark"] .btn-archive:hover,
[data-theme="dark"] .btn-archive-icon:hover {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.16);
}

[data-theme="dark"] .detail-tabs {
  background: color-mix(in srgb, var(--panel) 78%, var(--surface) 22%);
}

[data-theme="dark"] .detail-tab.is-active {
  background: color-mix(in srgb, var(--primary) 26%, var(--surface) 74%);
  color: #e7ebff;
  border-color: rgba(129, 140, 248, 0.45);
}

[data-theme="dark"] .detail-card {
  background: color-mix(in srgb, var(--card) 86%, var(--surface) 14%);
}

[data-theme="dark"] .count-pill {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .column {
  background: color-mix(in srgb, var(--surface) 76%, var(--panel) 24%);
  border-color: var(--line);
}

[data-theme="dark"] .lead-card {
  background: color-mix(in srgb, var(--card) 85%, var(--surface) 15%);
  border-color: var(--line);
}

[data-theme="dark"] .lead-card.is-selected {
  background: color-mix(in srgb, var(--primary) 20%, var(--surface) 80%);
  border-color: var(--primary);
}

[data-theme="dark"] .search-wrap {
  background: color-mix(in srgb, var(--panel) 82%, var(--surface) 18%);
}

[data-theme="dark"] .toolbar {
  background: color-mix(in srgb, var(--surface) 88%, var(--panel) 12%);
}

[data-theme="dark"] .column-count {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .badge,
[data-theme="dark"] .chip {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .ai-analysis-card {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.08), transparent);
  border-color: rgba(129, 140, 248, 0.2);
}

[data-theme="dark"] .status-open {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .status-new {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
}

[data-theme="dark"] .status-blocked {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .status-done {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .lead-card.is-new {
  background: color-mix(in srgb, rgba(59, 130, 246, 0.18) 45%, var(--surface) 55%);
  border-color: rgba(96, 165, 250, 0.45);
}

[data-theme="dark"] .tag-critical {
  background: rgba(239, 68, 68, 0.12);
}

[data-theme="dark"] .tag-warn {
  background: rgba(245, 158, 11, 0.12);
}

[data-theme="dark"] .tag-ok {
  background: rgba(34, 197, 94, 0.12);
}

[data-theme="dark"] .dash-mini-chart {
  background: transparent;
  border: none;
}

[data-theme="dark"] .dash-performance {
  background: var(--surface);
}

[data-theme="dark"] .dash-performance-chart {
  background: transparent;
  border: 0;
}

[data-theme="dark"] .euai-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--panel) 100%);
  border-color: rgba(129, 140, 248, 0.12);
}

[data-theme="dark"] .euai-avatar-wrap {
  background: linear-gradient(145deg, rgba(129, 140, 248, 0.12) 0%, rgba(129, 140, 248, 0.06) 100%);
  border-color: rgba(129, 140, 248, 0.1);
}

[data-theme="dark"] .euai-metric,
[data-theme="dark"] .euai-agent-chip {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .metric-chip {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .pipeline-combo-guideline {
  stroke: rgba(129, 140, 248, 0.14);
}

[data-theme="dark"] .pipeline-combo-bar-wrap {
  background: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .pipeline-combo-bar {
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.14);
}

[data-theme="dark"] .response-box {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .transition-hint:not(.ok):not(.warn):not(.danger) {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .empty-state {
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .kv-item {
  border-color: var(--line);
}

[data-theme="dark"] .toast {
  background: var(--toast-bg);
  color: var(--toast-text);
}

[data-theme="dark"] .profile-menu {
  background: var(--surface);
  border-color: var(--line);
}

[data-theme="dark"] .profile-btn {
  border-color: var(--line);
  background: var(--panel);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Theme transition for smooth switching */
body,
.app-shell,
.sidebar,
.workspace,
.toolbar,
.widget,
.dash-card,
.kpi-card,
.lead-card,
.column,
.btn,
.nav-link,
input,
select {
  transition: background-color 300ms ease, border-color 300ms ease, color 300ms ease;
}

/* --------------------------------------------------------------------------
   THEME TOGGLE BUTTON
   -------------------------------------------------------------------------- */

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 200ms var(--ease-out), background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  color: var(--primary);
  background: var(--surface);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Dataroom ───────────────────────────────────────────── */
.dr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.dr-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.dr-kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--panel) 12%);
  padding: 0.62rem 0.72rem;
}

.dr-kpi p {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.dr-kpi strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.06rem;
  font-weight: 800;
}

.dr-missing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}

.dr-readiness-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: color-mix(in srgb, var(--surface) 90%, var(--panel) 10%);
  margin-bottom: 0.55rem;
}

.dr-readiness-ok {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line) 65%);
}

.dr-readiness-warn {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--line) 60%);
}

.dr-readiness-title {
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.dr-readiness-sub {
  font-size: 0.77rem;
  color: var(--muted);
}

.dr-missing-short,
.dr-missing-full {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

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

.dr-toolbar-filters input[type="search"] {
  width: 290px;
  max-width: 100%;
}

.dr-toolbar-filters select {
  min-width: 170px;
}

.dr-input-modern,
.dr-select-modern {
  height: 42px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, var(--primary) 22%);
  background: color-mix(in srgb, var(--surface) 84%, var(--panel) 16%);
  color: var(--ink);
  padding: 0 0.85rem;
  font-size: 0.94rem;
  font-weight: 600;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.dr-input-modern::placeholder {
  color: color-mix(in srgb, var(--muted) 88%, var(--ink) 12%);
}

.dr-input-modern:focus,
.dr-select-modern:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent 78%);
  background: color-mix(in srgb, var(--surface) 90%, var(--primary-bg) 10%);
}

.dr-input-modern {
  width: 320px;
  max-width: min(420px, 100%);
}

.dr-select-modern {
  min-width: 180px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

.dr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.dr-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dr-help {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.dr-category-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
}

.dr-upload-btn {
  min-width: 132px;
  border-color: color-mix(in srgb, var(--line) 72%, var(--primary) 28%);
}

.dataroom-list-shell {
  display: grid;
  gap: 0.65rem;
}

.dataroom-category {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.dataroom-category h4 {
  margin: 0;
  padding: 0.5rem 0.65rem;
  font-size: 0.83rem;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, var(--surface) 22%);
}

.dr-list {
  display: grid;
}

.dr-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 130px minmax(0, 1fr) minmax(250px, 1fr);
  gap: 0.5rem;
  align-items: center;
  padding: 0.48rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

.dr-row:last-child {
  border-bottom: 0;
}

.dr-row:hover {
  background: color-mix(in srgb, var(--panel) 88%, var(--surface) 12%);
}

.dr-cell {
  min-width: 0;
}

.dr-slot-title,
.dr-doc-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dr-slot-sub,
.dr-doc-sub {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dr-cell-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.dr-cell-actions .btn {
  min-height: 34px;
}

.dr-action-btn {
  height: 34px;
  min-height: 34px;
  padding: 0 0.7rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

.dr-action-btn svg {
  flex: 0 0 auto;
  display: block;
}

.dr-action-btn-detail {
  padding-right: 0.55rem;
}

.dr-action-btn .dr-chevron {
  transition: transform 200ms var(--ease-out);
}

.dr-action-btn[aria-expanded="true"] .dr-chevron {
  transform: rotate(180deg);
}

.dr-icon-btn {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dr-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.dr-cell-detail {
  grid-column: 2 / -1;
  margin-top: 0.3rem;
  padding: 0.45rem 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 86%, var(--panel) 14%);
}

.dr-doc-history {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.22rem;
  font-size: 0.75rem;
}

.dr-doc-history a {
  color: var(--ink);
}

.pill.ok {
  background: #d9f2e0;
  color: #145522;
}

.pill.warn {
  background: #fde2d2;
  color: #7c3a10;
}

.pill.pending {
  background: #fff3c4;
  color: #6e5300;
}

.pill.subtle {
  background: #f0f0f3;
  color: #4a4a55;
}

.dataroom-upload-modal-card {
  width: min(680px, 96vw);
}

.dataroom-upload-modal-body {
  display: grid;
  gap: 0.9rem;
  padding: 0.2rem 0 0.8rem;
}

.dataroom-upload-modal-card .field {
  display: grid;
  gap: 0.38rem;
}

.dataroom-upload-modal-card .field > label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.dataroom-upload-modal-card select,
.dataroom-upload-modal-card input[type="text"] {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, var(--surface) 16%);
  background: color-mix(in srgb, var(--surface) 92%, var(--panel) 8%);
  padding: 0.56rem 0.78rem;
  color: var(--ink);
  font: 600 0.9rem/1.4 'Manrope', sans-serif;
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out), background 180ms var(--ease-out);
}

.dataroom-upload-modal-card input[type="text"]::placeholder {
  color: color-mix(in srgb, var(--muted) 84%, transparent 16%);
}

.dataroom-upload-modal-card select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.2rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.dataroom-upload-modal-card select:focus,
.dataroom-upload-modal-card input[type="text"]:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 64%, var(--line) 36%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent 82%);
  background: color-mix(in srgb, var(--surface) 96%, var(--panel) 4%);
}

.dataroom-upload-file-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  border: 1px solid color-mix(in srgb, var(--line) 84%, var(--surface) 16%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, var(--panel) 8%);
  padding: 0.42rem;
}

.dataroom-upload-file-row #pickDataroomUploadFileBtn {
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
}

.dataroom-upload-file-row .meta-muted {
  font-size: 0.84rem;
}

.dataroom-upload-modal-card .modal-actions {
  margin-top: 0.1rem;
}

.dataroom-missing-modal-card {
  width: min(760px, 96vw);
}

.dataroom-missing-modal-body {
  display: grid;
  gap: 0.7rem;
  max-height: min(62vh, 560px);
  overflow: auto;
}

.dataroom-missing-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.45rem;
}

.dataroom-missing-list li {
  line-height: 1.45;
}

[data-theme="dark"] .dataroom-upload-modal-card select,
[data-theme="dark"] .dataroom-upload-modal-card input[type="text"],
[data-theme="dark"] .dataroom-upload-file-row {
  background: color-mix(in srgb, var(--surface) 84%, var(--panel) 16%);
  border-color: color-mix(in srgb, var(--line) 74%, #ffffff 26%);
}

@media (max-width: 1200px) {
  .dr-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dr-row {
    grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
  }

  .dr-cell-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .dr-kpi-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .dr-toolbar {
    align-items: stretch;
  }

  .dr-toolbar-filters {
    width: 100%;
  }

  .dr-toolbar-filters input[type="search"] {
    width: 100%;
  }

  .dr-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .dr-cell-status,
  .dr-cell-doc,
  .dr-cell-actions {
    grid-column: 1 / -1;
  }

  .dr-cell-status {
    margin-top: 0.2rem;
  }
}

/* --------------------------------------------------------------------------
   Z1. SETTINGS — Tab-Shell (Sidebar-Navigation, One-View, No-Scroll)
   -------------------------------------------------------------------------- */

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.settings-head h1 {
  margin: 0 0 0.25rem 0;
}

.settings-subtitle {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  max-width: 54ch;
}

/* Shell: two columns — sidebar + content */
.settings-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 0;
}

/* --- Sidebar --- */
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.55rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  align-self: start;
  position: sticky;
  top: 1rem;
}

.settings-nav-group-title {
  margin: 0.6rem 0.55rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-nav-group-title:first-child {
  margin-top: 0.1rem;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.settings-nav-item:hover {
  background: var(--panel);
}

.settings-nav-item:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.settings-nav-item.is-active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.settings-nav-item.is-active:hover {
  background: var(--primary);
}

.settings-nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex: 0 0 20px;
}

.settings-nav-icon svg {
  width: 18px;
  height: 18px;
}

/* --- Content area --- */
.settings-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.settings-panel {
  display: none;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  animation: settings-panel-in 180ms var(--ease-out);
}

.settings-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@keyframes settings-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.settings-panel-head h2 {
  margin: 0 0 0.2rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.settings-panel-head p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Legacy helper classes still used elsewhere in the app */
.settings-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.settings-card-head h3 {
  margin: 0 0 0.15rem 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.settings-card-sub {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Form variants within settings */
.settings-form-stack {
  display: grid;
  gap: 0.55rem;
}

.settings-form-toggles {
  display: grid;
  gap: 0.55rem;
}

.settings-form-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.settings-form-2col > .settings-toggle,
.settings-form-2col > label {
  min-width: 0;
}

/* Toggle rows (checkbox + descriptive label) */
.settings-toggle {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  font-weight: 500 !important;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.settings-toggle:hover {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.12);
}

.settings-toggle input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.settings-toggle-label {
  display: grid;
  gap: 0.15rem;
}

.settings-toggle-label > span:first-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.settings-toggle-label > span + span {
  font-size: 0.76rem;
  line-height: 1.35;
}

/* Inline status text under forms */
.settings-inline-status {
  font-size: 0.78rem;
  line-height: 1.3;
  margin: 0;
  min-height: 1em;
}

.settings-inline-status.is-ok { color: var(--success, #16a34a); }
.settings-inline-status.is-err { color: var(--danger, #dc2626); }

/* Form actions row */
.settings-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.settings-form-actions .settings-inline-status {
  flex: 1 1 auto;
}

/* Sticky save bar at bottom of System group */
.settings-save-bar {
  position: sticky;
  bottom: 0.5rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
  flex-wrap: wrap;
}

.settings-save-bar-text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 240px;
}

.settings-save-bar-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.settings-save-bar .meta-muted {
  margin: 0;
  font-size: 0.78rem;
}

.settings-save-bar .btn {
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Z2. PROFILE UPLOAD — Preview + Dropzone + Actions
   -------------------------------------------------------------------------- */

.profile-upload {
  display: grid;
  gap: 0.85rem;
}

.profile-upload-preview {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.profile-upload-preview img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  object-fit: cover;
  background: var(--surface);
}

.profile-upload-info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.profile-upload-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-upload-info .meta-muted {
  margin: 0;
  font-size: 0.78rem;
}

.profile-upload-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-upload-actions .btn {
  flex: 0 0 auto;
}

/* Dropzone */
.dropzone {
  position: relative;
  display: block;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 1.4rem 1rem;
  cursor: pointer;
  transition: border-color 180ms var(--ease-out),
              background 180ms var(--ease-out),
              transform 180ms var(--ease-out);
  text-align: center;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--primary);
  background: var(--primary-ring);
}

.dropzone.is-hover {
  border-color: var(--primary);
  background: var(--primary-ring);
  transform: scale(1.005);
}

.dropzone.is-uploading {
  pointer-events: none;
  cursor: progress;
}

.dropzone.is-error {
  border-color: var(--danger, #dc2626);
  background: rgba(220, 38, 38, 0.05);
}

.dropzone-inner {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}

.dropzone.is-uploading .dropzone-inner {
  opacity: 0.35;
}

.dropzone-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--line);
}

.dropzone-icon svg {
  width: 22px;
  height: 22px;
}

.dropzone-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.dropzone-hint {
  margin: 0;
  font-size: 0.76rem;
}

.dropzone-progress {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  border-radius: 10px;
}

.dropzone-progress[hidden] { display: none !important; }

.dropzone-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: dz-spin 700ms linear infinite;
}

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

/* Responsive tweaks */
@media (max-width: 980px) {
  .settings-shell {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    gap: 0.35rem;
    scrollbar-width: thin;
  }
  .settings-nav-group-title {
    display: none;
  }
  .settings-nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 780px) {
  .settings-form-2col {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr !important;
  }
  .settings-save-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-save-bar .btn {
    width: 100%;
  }
  .profile-upload-preview {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .profile-upload-preview img {
    width: 64px;
    height: 64px;
  }
  .settings-panel {
    padding: 0.9rem 1rem;
  }
}

/* --------------------------------------------------------------------------
   H1. VERLAUF-TAB — KPI Tiles, Filter Chips, Quick-Capture, Tagesgruppierung
   -------------------------------------------------------------------------- */

.history-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0 0.85rem;
}

.history-kpi {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.history-kpi-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--primary);
  font-size: 0.95rem;
  border: 1px solid var(--line);
}

.history-kpi > div {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.05;
}

.history-kpi strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.history-kpi span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.history-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
}

.history-chip {
  height: 30px;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.history-chip:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: color-mix(in srgb, var(--line) 60%, var(--primary) 40%);
}

.history-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.history-quickcapture {
  margin: 0 0 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0;
  background: color-mix(in srgb, var(--panel) 60%, var(--surface) 40%);
  overflow: hidden;
}

.history-quickcapture > summary,
.history-quickcapture > .btn {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  width: 100%;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
  background: transparent;
  border: 0;
}

.history-quickcapture > summary::-webkit-details-marker {
  display: none;
}

.history-quickcapture-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--primary);
  transition: transform 200ms var(--ease-out);
}

.history-quickcapture[open] .history-quickcapture-icon {
  transform: rotate(45deg);
}

.history-quickcapture-form {
  padding: 0.6rem 0.85rem 0.85rem;
}

.history-entry-modal-card {
  width: min(760px, 96vw);
}

.matching-request-modal-card {
  width: min(820px, 96vw);
}

.history-entry-modal-body {
  display: grid;
  gap: 0.7rem;
}

.history-entry-lead-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 0.25rem 0.65rem;
  max-width: 100%;
  font-size: 0.78rem;
}

.history-entry-lead-pill strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-entry-grid {
  padding: 0;
}

.history-entry-grid > textarea {
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.55rem 0.68rem;
  resize: vertical;
  min-height: 104px;
}

.history-entry-grid > textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

.history-event-stream {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-day-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-day-label {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  padding-left: 0.05rem;
}

.history-day-items {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out);
}

.history-item:hover {
  background: color-mix(in srgb, var(--panel) 86%, var(--surface) 14%);
}

.history-item-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}

.history-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.history-item-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tone-Varianten — Linker Akzentstreifen + Tag-Farbe */
.history-item.is-email { border-left-color: #6366f1; }
.history-item.is-email .history-item-tag { color: #6366f1; }

.history-item.is-call { border-left-color: #10b981; }
.history-item.is-call .history-item-tag { color: #10b981; }

.history-item.is-meeting { border-left-color: #8b5cf6; }
.history-item.is-meeting .history-item-tag { color: #8b5cf6; }

.history-item.is-note { border-left-color: #94a3b8; }
.history-item.is-note .history-item-tag { color: #64748b; }

.history-item.is-task { border-left-color: #f59e0b; }
.history-item.is-task .history-item-tag { color: #b45309; }

.history-item.is-reminder { border-left-color: #ef4444; }
.history-item.is-reminder .history-item-tag { color: #b91c1c; }

.history-item.is-event { border-left-color: #0ea5e9; }
.history-item.is-event .history-item-tag { color: #0369a1; }

@media (max-width: 780px) {
  .history-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .history-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

/* API-Key explizit neutral darstellen — kein blauer Link/Highlight */
.ai-status-key-mono {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: var(--ink) !important;
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-decoration: none !important;
}

/* --------------------------------------------------------------------------
   H2. SETTINGS — Audit-Protokoll-Block im Audit & Backup Panel
   -------------------------------------------------------------------------- */

.settings-audit-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.settings-audit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.settings-audit-title {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.settings-audit-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.2rem;
}

/* --------------------------------------------------------------------------
   C1. COMPLIANCE-COCKPIT — Bonitätsprüfung
   -------------------------------------------------------------------------- */

.page-subline {
  margin: 0.2rem 0 0.65rem;
  font-size: 0.85rem;
  max-width: 720px;
}

.page-subline strong {
  color: var(--ink);
}

.compliance-kpi-band {
  margin-bottom: 0.85rem;
}

.compliance-pending-card,
.compliance-history-card {
  margin-bottom: 0.85rem;
}

.compliance-block-hint {
  margin: -0.15rem 0 0.6rem;
  font-size: 0.82rem;
}

.compliance-pending-list,
.compliance-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.compliance-empty {
  margin: 0.5rem 0;
  font-size: 0.86rem;
}

/* Pending row + Inline-Form */
.compliance-pending-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color 200ms var(--ease-out);
}

.compliance-pending-row:hover {
  border-color: color-mix(in srgb, var(--line) 60%, var(--primary) 40%);
}

.compliance-pending-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
}

.compliance-pending-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.compliance-pending-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.compliance-pending-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.compliance-score-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem 0.7rem;
  padding: 0.7rem 0.85rem 0.85rem;
  border-top: 1px dashed var(--line);
  background: color-mix(in srgb, var(--panel) 60%, var(--surface) 40%);
}

.compliance-score-form[hidden] {
  display: none;
}

.compliance-score-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.compliance-score-field > span:first-child {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.compliance-score-field input,
.compliance-score-field select {
  height: 36px;
  padding: 0 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.compliance-score-field input:focus,
.compliance-score-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.compliance-score-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.compliance-score-field .compliance-score-pill {
  width: fit-content;
}

.compliance-score-override-toggle .settings-toggle {
  margin-top: 0.1rem;
}

.compliance-score-override-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.7rem;
}

.compliance-score-field-wide {
  grid-column: 1 / -1;
}

.compliance-score-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.1rem;
}

@media (max-width: 720px) {
  .compliance-score-form {
    grid-template-columns: 1fr;
  }

  .compliance-score-override-fields {
    grid-template-columns: 1fr;
  }
}

/* History row */
.compliance-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.compliance-history-row.is-good { border-left-color: #10b981; }
.compliance-history-row.is-warn { border-left-color: #f59e0b; }
.compliance-history-row.is-bad  { border-left-color: #ef4444; }
.compliance-history-row.is-neutral { border-left-color: var(--line); }

.compliance-history-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.compliance-history-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compliance-history-sub {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compliance-history-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compliance-score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 26px;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.compliance-score-pill.is-good {
  background: #ecfdf5;
  color: #047857;
  border-color: rgba(16, 185, 129, 0.3);
}

.compliance-score-pill.is-warn {
  background: #fffbeb;
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.3);
}

.compliance-score-pill.is-bad {
  background: #fef2f2;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.3);
}

.compliance-history-status {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.compliance-history-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .compliance-history-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .compliance-history-score,
  .compliance-history-meta {
    justify-content: flex-start;
  }
}

/* Dark theme adjustments */
[data-theme="dark"] .compliance-score-pill.is-good {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}
[data-theme="dark"] .compliance-score-pill.is-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}
[data-theme="dark"] .compliance-score-pill.is-bad {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* Shortcut-Button im Lead-Detail-Checklist für credit-check Systempunkte */
.check-shortcut {
  height: 28px;
  padding: 0 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  margin-right: 0.3rem;
}

/* --------------------------------------------------------------------------
   P1. PIPELINE-FUNNEL — Dashboard-Widget (Stage-Funnel mit Conversion)
   -------------------------------------------------------------------------- */

.pipeline-funnel {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.15rem 0 0;
}

.pipeline-funnel-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0;
  transition: opacity 200ms var(--ease-out);
}

.pipeline-funnel-row.is-empty {
  opacity: 0.45;
}

.pipeline-funnel-row:hover:not(.is-empty) {
  opacity: 1;
}

.pipeline-funnel-stage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.pipeline-funnel-stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  flex: 0 0 auto;
}

.pipeline-funnel-stage-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-funnel-bar-wrap {
  height: 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}

.pipeline-funnel-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light, #818cf8) 100%);
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.18);
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.pipeline-funnel-row:nth-child(1) .pipeline-funnel-bar { background: linear-gradient(90deg, #6366f1, #818cf8); }
.pipeline-funnel-row:nth-child(3) .pipeline-funnel-bar { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.pipeline-funnel-row:nth-child(5) .pipeline-funnel-bar { background: linear-gradient(90deg, #06b6d4, #67e8f9); }
.pipeline-funnel-row:nth-child(7) .pipeline-funnel-bar { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.pipeline-funnel-row:nth-child(9) .pipeline-funnel-bar { background: linear-gradient(90deg, #f59e0b, #fcd34d); }

.pipeline-funnel-bar-empty {
  width: 6%;
  background: var(--line) !important;
  box-shadow: none !important;
  opacity: 0.5;
}

.pipeline-funnel-count {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pipeline-funnel-row.is-empty .pipeline-funnel-count {
  color: var(--muted);
  font-weight: 600;
}

/* Conversion-Indikator zwischen Stages */
.pipeline-funnel-conversion {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 48px;
  gap: 0.7rem;
  align-items: center;
  padding: 0 0;
  margin: -0.1rem 0;
  pointer-events: none;
}

.pipeline-funnel-conversion .pipeline-funnel-arrow {
  grid-column: 1;
  justify-self: end;
  padding-right: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1;
  opacity: 0.55;
}

.pipeline-funnel-conversion-value {
  grid-column: 2;
  justify-self: start;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.pipeline-funnel-conversion.is-muted .pipeline-funnel-conversion-value {
  opacity: 0.4;
}

/* Summary-Footer */
.pipeline-funnel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.pipeline-funnel-summary-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.pipeline-funnel-summary-value {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pipeline-funnel-empty {
  margin: 1.2rem 0;
  text-align: center;
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .pipeline-funnel-row,
  .pipeline-funnel-conversion {
    grid-template-columns: 100px minmax(0, 1fr) 40px;
    gap: 0.5rem;
  }
  .pipeline-funnel-stage-label {
    font-size: 0.78rem;
  }
}

/* --------------------------------------------------------------------------
   K1. CHECKLISTE — Modernes Cockpit-Design
   -------------------------------------------------------------------------- */

/* Header-Karte: Donut + Headline + KPIs */
.check-summary-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 0.85rem;
}

.check-summary-donut {
  position: relative;
  width: 88px;
  height: 88px;
}

.check-summary-donut svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.check-summary-donut-bg {
  stroke: var(--line);
}

.check-summary-donut-fg {
  stroke: #10b981;
  transition: stroke-dasharray 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.check-summary-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.check-summary-text {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.check-summary-kicker {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.check-summary-headline {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.check-summary-sub {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.check-summary-kpis {
  display: flex;
  align-items: stretch;
  gap: 1.2rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--line);
}

.check-summary-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 52px;
}

.check-summary-kpi strong {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.check-summary-kpi span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .check-summary-card {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .check-summary-donut { width: 72px; height: 72px; }
  .check-summary-kpis {
    grid-column: 1 / -1;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 0.6rem;
    justify-content: space-around;
  }
}

/* Sektionen mit Icon-Header */
.check-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.check-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--line);
}

.check-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.check-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  flex: 0 0 auto;
}

.check-section-title h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.check-section-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.check-section-rows {
  display: flex;
  flex-direction: column;
}

/* Einzelne Zeile */
.check-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color 160ms var(--ease-out);
}

.check-row:last-child {
  border-bottom: 0;
}

.check-row:hover:not(.is-system) {
  background: color-mix(in srgb, var(--surface) 86%, var(--panel) 14%);
}

.check-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  flex: 0 0 auto;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.check-row-icon.is-done {
  background: #d1fae5;
  color: #047857;
}

.check-row-icon.is-todo {
  background: var(--panel);
  color: var(--muted);
}

.check-row-icon.is-blocked {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .check-row-icon.is-done { background: rgba(16, 185, 129, 0.18); color: #34d399; }
[data-theme="dark"] .check-row-icon.is-todo { background: var(--panel); }
[data-theme="dark"] .check-row-icon.is-blocked { background: rgba(239, 68, 68, 0.18); color: #f87171; }

.check-row-title-btn {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 0;
  min-width: 0;
  cursor: pointer;
  color: var(--ink);
}

.check-row-title-btn.is-static {
  cursor: default;
}

.check-row-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-row-sub {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-row.status-done .check-row-title {
  color: var(--ink);
}

.check-row-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.check-row-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.check-row-badge.chip-done {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.check-row-badge.chip-todo {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
}

.check-row-badge.chip-blocked {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.check-row-badge-system {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

[data-theme="dark"] .check-row-badge.chip-done { background: rgba(16, 185, 129, 0.14); color: #34d399; }
[data-theme="dark"] .check-row-badge.chip-blocked { background: rgba(239, 68, 68, 0.14); color: #f87171; }

.check-shortcut-btn {
  height: 26px;
  padding: 0 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms, color 160ms, border-color 160ms;
}

.check-shortcut-btn:hover {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.check-help {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .check-row {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .check-row-actions {
    grid-column: 2;
    justify-content: flex-end;
  }
}

/* --------------------------------------------------------------------------
   K2. CHECKLISTE V2 — Sektion + Sidebar-Layout (Screenshot-konform)
   -------------------------------------------------------------------------- */

.check-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}

.check-main {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  min-width: 0;
}

/* Sektion — kein Card-Rahmen mehr, nur Header + Zeilen */
.check-shell .check-section {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin: 0;
  overflow: visible;
  padding: 0;
}

.check-shell .check-section-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0 0 0.55rem;
  border-bottom: 0;
}

.check-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.check-section-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.check-shell .check-section-rows {
  display: flex;
  flex-direction: column;
}

/* Zeile — neues Layout: Icon | Body | rechts */
.check-shell .check-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0;
  border-bottom: 0;
  background: transparent;
}

.check-shell .check-row + .check-row {
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.check-shell .check-row:hover {
  background: transparent;
}

.check-shell .check-row-icon {
  width: 22px;
  height: 22px;
}

/* Waiting-Pulse */
.check-row-icon.is-waiting {
  background: transparent;
  border: 2px dashed #f59e0b;
  position: relative;
  animation: checkWaitingPulse 1.8s ease-in-out infinite;
}

.check-row-icon-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 2px solid rgba(245, 158, 11, 0.35);
  animation: checkWaitingRing 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes checkWaitingPulse {
  0%, 100% { border-color: #f59e0b; }
  50% { border-color: rgba(245, 158, 11, 0.4); }
}

@keyframes checkWaitingRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.check-row-body {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 0;
  min-width: 0;
  cursor: pointer;
  color: var(--ink);
}

.check-row-body.is-static {
  cursor: default;
}

.check-row-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-row-lock {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  opacity: 0.75;
}

.check-row-sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-row-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.check-row-time {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.check-row-right-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.check-row-right-badge.chip-warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .check-row-right-badge.chip-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* Sidebar rechts */
.check-sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.check-sidebar-percent {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 0.2rem;
}

.check-sidebar-sub {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.7rem;
}

.check-sidebar-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--panel);
  overflow: hidden;
  margin-bottom: 1.1rem;
}

.check-sidebar-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.check-sidebar-meta {
  margin: 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.check-sidebar-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.85rem;
}

.check-sidebar-meta-row dt {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}

.check-sidebar-meta-row dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.check-sidebar-meta-row dd.is-warn {
  color: #b45309;
}

[data-theme="dark"] .check-sidebar-meta-row dd.is-warn {
  color: #fbbf24;
}

.check-sidebar-meta-row dd.is-good {
  color: #047857;
}

[data-theme="dark"] .check-sidebar-meta-row dd.is-good {
  color: #34d399;
}

.check-sidebar-cta {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms, color 160ms, border-color 160ms, transform 160ms;
}

.check-sidebar-cta:not(:disabled):hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.check-sidebar-cta:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Header-Card (alte) versteckt wenn check-shell aktiv ist */
.check-shell ~ .check-summary-card,
.check-shell + .check-summary-card {
  display: none;
}

/* Responsive: Sidebar unter Main */
@media (max-width: 980px) {
  .check-shell {
    grid-template-columns: 1fr;
  }
  .check-sidebar {
    position: static;
    order: -1;
  }
}
