/* ==========================================================================
   Patient360 Command Center — Futuristic Minimal Theme
   ========================================================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(17, 24, 39, 0.5);
    --border-color: rgba(56, 189, 248, 0.08);
    --border-glow: rgba(56, 189, 248, 0.2);
    --accent: #38bdf8;
    --accent-2: #818cf8;
    --accent-3: #34d399;
    --accent-red: #f87171;
    --accent-amber: #fbbf24;
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e1;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---------- Scrollbar ---------- */
/* Standard scrollbar styling (Firefox) */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}
/* Webkit scrollbar styling (Chrome, Edge, Safari) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.brand-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.text-accent { color: var(--accent); }

.sidebar-nav {
    list-style: none;
    padding: 12px 8px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.sidebar-nav .nav-link i { font-size: 18px; }

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.06);
}

.sidebar-nav .nav-link.active {
    color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.glass-select {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    border-radius: var(--radius-sm) !important;
}

.glass-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15) !important;
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 14, 23, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
    color: #ffffff;
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.15);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
}

.topbar-time {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
}

.content-area {
    padding: 24px;
    font-size: 14px;
    color: #ffffff;
}

/* ==========================================================================
   Cards — Glassmorphism
   ========================================================================== */

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-glow);
}

.glass-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.glass-card-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* ==========================================================================
   Stat Cards
   ========================================================================== */

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--glow-color, rgba(56,189,248,0.04)) 0%, transparent 70%);
    pointer-events: none;
}

.stat-icon.blue { background: rgba(56, 189, 248, 0.12); color: var(--accent); }
.stat-icon.purple { background: rgba(129, 140, 248, 0.12); color: var(--accent-2); }
.stat-icon.green { background: rgba(52, 211, 153, 0.12); color: var(--accent-3); }
.stat-icon.red { background: rgba(248, 113, 113, 0.12); color: var(--accent-red); }
.stat-icon.amber { background: rgba(251, 191, 36, 0.12); color: var(--accent-amber); }

/* ==========================================================================
   Tables
   ========================================================================== */

.glass-table {
    width: 100%;
    border-collapse: collapse;
}

.glass-table thead th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.glass-table tbody td {
    font-size: 14px;
    color: var(--text-primary);
    padding: 10px 12px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.04);
    vertical-align: middle;
}

.glass-table tbody tr { transition: var(--transition); }

.glass-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.04);
}

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

/* ==========================================================================
   Badges & Pills
   ========================================================================== */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-critical { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }
.badge-high { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.badge-medium { background: rgba(56, 189, 248, 0.15); color: var(--accent); }
.badge-low { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }
.badge-pending { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.badge-sent { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }
.badge-active { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }
.badge-opportunity { background: rgba(129, 140, 248, 0.15); color: var(--accent-2); }
.badge-realized { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }
.badge-leakage { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }

.badge-us { background: rgba(56, 189, 248, 0.1); color: var(--accent); }
.badge-dubai { background: rgba(251, 191, 36, 0.1); color: var(--accent-amber); }

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

.risk-critical { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }
.risk-high { background: var(--accent-amber); box-shadow: 0 0 6px var(--accent-amber); }
.risk-medium { background: var(--accent); }
.risk-low { background: var(--accent-3); }

/* ==========================================================================
   Forms
   ========================================================================== */

.glass-input {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
}

.glass-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12) !important;
}

.glass-input::placeholder { color: var(--text-muted) !important; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-accent:hover {
    opacity: 0.9;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
}

.btn-glass {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-glass:hover {
    border-color: var(--border-glow);
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.06);
}

.btn-sm-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 14px;
}

.btn-sm-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

/* ==========================================================================
   Charts
   ========================================================================== */

.chart-container {
    position: relative;
    width: 100%;
    height: 260px;
}

/* ==========================================================================
   Patient Detail — 360 View
   ========================================================================== */

.patient-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.patient-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.risk-meter {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin-top: 8px;
}

.risk-meter-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   AI Insights Panel
   ========================================================================== */

.insight-card {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
}

.insight-card.cross-sell { border-left-color: var(--accent-3); }
.insight-card.up-sell { border-left-color: var(--accent-2); }
.insight-card.leakage { border-left-color: var(--accent-red); }
.insight-card.retention { border-left-color: var(--accent-amber); }
.insight-card.critical { border-left-color: var(--accent-red); }

.confidence-bar {
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.confidence-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
}

/* ==========================================================================
   Spinner / Loading
   ========================================================================== */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner-ring {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Tabs (glass style)
   ========================================================================== */

.glass-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(17, 24, 39, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.glass-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
}

.glass-tab:hover { color: var(--text-secondary); }

.glass-tab.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
}

/* ==========================================================================
   Modal Override
   ========================================================================== */

.modal-content {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
}

.modal-header { border-bottom: 1px solid var(--border-color) !important; }
.modal-footer { border-top: 1px solid var(--border-color) !important; }

/* ==========================================================================
   ICD-CCD Flow Indicator
   ========================================================================== */

.mapping-flow {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mapping-flow .flow-arrow {
    color: var(--accent);
    font-size: 14px;
}

.code-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

.code-icd { background: rgba(248, 113, 113, 0.12); color: var(--accent-red); }
.code-ccd { background: rgba(52, 211, 153, 0.12); color: var(--accent-3); }
.code-snomed { background: rgba(129, 140, 248, 0.12); color: var(--accent-2); }

.badge-map-one { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }
.badge-map-many { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* ==========================================================================
   Utility
   ========================================================================== */

.text-accent { color: var(--accent) !important; }
.text-accent-2 { color: var(--accent-2) !important; }
.text-accent-3 { color: var(--accent-3) !important; }
.text-red { color: var(--accent-red) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-muted-custom { color: var(--text-muted) !important; }

.cursor-pointer { cursor: pointer; }

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gap-grid { gap: 16px; }

/* ==========================================================================
   Timeline
   ========================================================================== */

.timeline {
    position: relative;
    padding-left: 44px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.timeline-item:hover {
    border-color: var(--border-glow);
}

.timeline-marker {
    position: absolute;
    left: -36px;
    top: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    z-index: 1;
}

.timeline-marker.blue { background: var(--accent); }
.timeline-marker.amber { background: var(--accent-amber); }
.timeline-marker.green { background: var(--accent-3); }
.timeline-marker.red { background: var(--accent-red); }
.timeline-marker.purple { background: var(--accent-2); }

/* ==========================================================================
   Care Pathway Stepper
   ========================================================================== */

.pathway-stepper {
    display: flex;
    align-items: flex-start;
}

.pathway-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.pathway-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.pathway-step-dot.completed {
    background: var(--accent-3);
    color: #fff;
}

.pathway-step-dot.current {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25);
    animation: pulse-dot 2s infinite;
}

.pathway-step-dot.future {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25); }
    50% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.1); }
}

.pathway-step-line {
    position: absolute;
    top: 14px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 0;
}

.pathway-step-line.completed {
    background: var(--accent-3);
}

.pathway-step-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

/* ==========================================================================
   Clinical Code Chips (ICD-10 & CPT)
   ========================================================================== */

.code-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    cursor: default;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.code-chip.icd {
    background: rgba(129, 140, 248, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(129, 140, 248, 0.25);
}

.code-chip.icd:hover {
    background: rgba(129, 140, 248, 0.25);
    border-color: rgba(129, 140, 248, 0.5);
}

.code-chip.cpt {
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.code-chip.cpt:hover {
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.45);
}

.code-chip .chip-label {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    font-weight: 700;
}

.code-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

/* Code tooltip */
.code-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg-solid, #1e293b);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 400;
    font-family: var(--font-body, 'Inter', sans-serif);
    color: var(--text-primary);
    white-space: normal;
    min-width: 200px;
    max-width: 320px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    line-height: 1.4;
}

.code-chip:hover .code-tooltip {
    opacity: 1;
}

.code-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

/* Guideline callout */
.guideline-callout {
    background: rgba(56, 189, 248, 0.06);
    border-left: 3px solid rgba(56, 189, 248, 0.5);
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-top: 8px;
}

.guideline-callout i {
    color: var(--accent);
}

/* Pathway definition drawer */
.pathway-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pathway-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.pathway-drawer {
    position: fixed;
    top: 0;
    right: -520px;
    width: 520px;
    max-width: 90vw;
    height: 100vh;
    background: var(--glass-bg-solid, #0f172a);
    border-left: 1px solid var(--border-color);
    z-index: 2001;
    overflow-y: auto;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 24px;
}

.pathway-drawer.open {
    right: 0;
}

.pathway-drawer .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.pathway-drawer .drawer-close {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 4px 8px;
    cursor: pointer;
    transition: var(--transition);
}

.pathway-drawer .drawer-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.drawer-stage-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.drawer-stage-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.drawer-stage-card.active-stage {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.06);
}

.drawer-stage-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Code search modal */
.code-search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.code-search-backdrop.show {
    display: flex;
}

.code-search-dialog {
    background: var(--glass-bg-solid, #0f172a);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 600px;
    max-width: 90vw;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.code-search-dialog .search-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.code-search-dialog .search-header input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-body);
}
.code-search-dialog .search-header input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.code-search-dialog .search-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-color);
}

.code-search-dialog .search-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-muted);
    transition: var(--transition);
}

.code-search-dialog .search-tab.active {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
}

.code-search-dialog .search-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

.code-search-results {
    overflow-y: auto;
    max-height: 45vh;
    padding: 8px;
}

.code-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: default;
    transition: var(--transition);
}

.code-search-result:hover {
    background: rgba(255, 255, 255, 0.05);
}

.code-search-result .result-code {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    min-width: 70px;
}

.code-search-result .result-code.icd { color: #a5b4fc; }
.code-search-result .result-code.cpt { color: #6ee7b7; }

.code-search-result .result-desc {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}

/* Pathway card code sections */
.card-codes-section {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 10px;
}

.card-codes-column {
    flex: 1;
    min-width: 0;
}

.card-codes-column .codes-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 6px;
}

.card-codes-column .codes-label.icd-label { color: #818cf8; }
.card-codes-column .codes-label.cpt-label { color: #34d399; }

/* KPI Enhancement */
.kpi-micro {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Overdue pulse animation */
.overdue-pulse {
    border-left: 3px solid rgba(248, 113, 113, 0.6) !important;
}

/* Pathway type color bars */
.pathway-type-bar {
    width: 4px;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: stretch;
}

/* ==========================================================================
   Priority Score Bar
   ========================================================================== */

.score-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Additional Badges
   ========================================================================== */

.badge-open { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.badge-resolved { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }
.badge-contacted { background: rgba(56, 189, 248, 0.15); color: var(--accent); }
.badge-in-progress { background: rgba(129, 140, 248, 0.15); color: var(--accent-2); }
.badge-completed { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); }

.badge-standard { background: rgba(56, 189, 248, 0.1); color: var(--accent); }
.badge-premium { background: rgba(129, 140, 248, 0.1); color: var(--accent-2); }
.badge-high-risk { background: rgba(251, 191, 36, 0.1); color: var(--accent-amber); }

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.toast-msg {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    margin-top: 8px;
}

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

/* Toast Notification — Enhanced typed toasts */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 4px solid var(--accent-3);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
}
.toast-error { border-left-color: var(--accent-red) !important; }
.toast-error i { color: var(--accent-red) !important; }
.toast-warning { border-left-color: var(--accent-amber) !important; }
.toast-warning i { color: var(--accent-amber) !important; }
.toast-info { border-left-color: var(--accent-2) !important; }
.toast-info i { color: var(--accent-2) !important; }
.toast-success { border-left-color: var(--accent-3) !important; }
.toast-success i { color: var(--accent-3) !important; }

/* ==========================================================================
   Waterfall Chart Helpers
   ========================================================================== */

.waterfall-metric {
    text-align: center;
    padding: 12px;
}

.waterfall-metric .wf-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.waterfall-metric .wf-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.progress-thin {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin-top: 6px;
}

.progress-thin-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s;
}

/* ==========================================================================
   Timeline Filter Buttons
   ========================================================================== */

.filter-btn {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
}

/* ==========================================================================
   Outline Accent Buttons (Language toggle, etc.)
   ========================================================================== */

.btn-outline-accent {
    border: 1px solid var(--border-glow);
    color: var(--text-secondary);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

.btn-outline-accent:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

.btn-outline-accent.active {
    border-color: var(--accent);
    color: var(--bg-primary);
    background: var(--accent);
}

/* ==========================================================================
   Tab Pane Custom (Patient Detail tabs)
   ========================================================================== */

.tab-pane-custom {
    animation: fadeIn 0.2s ease;
}

/* @keyframes fadeIn — removed duplicate, see first declaration above */

/* ==========================================================================
   Error State
   ========================================================================== */

.error-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--accent-red);
}

.error-state i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
    opacity: 0.6;
}

.error-state p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   Enhanced UI — Animated Counters, Trends, Mini Charts
   ========================================================================== */

/* KPI trend arrows */
.trend-up { color: var(--accent-3); font-size: 12px; font-weight: 600; }
.trend-up::before { content: '\25B2 '; }
.trend-down { color: var(--accent-red); font-size: 12px; font-weight: 600; }
.trend-down::before { content: '\25BC '; }
.trend-neutral { color: var(--text-muted); font-size: 12px; font-weight: 600; }

/* Stat card with trend */
.stat-card .stat-trend { margin-top: 6px; font-size: 11px; }

/* Mini SVG gauge */
.mini-gauge { width: 48px; height: 48px; flex-shrink: 0; }
.mini-gauge-lg { width: 72px; height: 72px; flex-shrink: 0; }

/* Patient card grid view */
.patient-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.patient-card {
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.patient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-color: var(--border-glow);
}

/* View toggle */
.view-toggle .btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Expandable row */
.expandable-trigger { cursor: pointer; }
.expandable-trigger .expand-icon { transition: transform 0.3s; }
.expandable-trigger.open .expand-icon { transform: rotate(90deg); }
.expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}
.expand-content.open {
    max-height: 600px;
}

/* Score breakdown bars */
.score-breakdown {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
}
.score-segment { transition: width 0.6s ease-out; height: 100%; }

/* Mini donut container */
.mini-donut-container {
    width: 80px;
    height: 80px;
    position: relative;
    flex-shrink: 0;
}
.mini-donut-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
}

/* Action bar */
.action-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    flex-wrap: wrap;
}
.action-card {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}
.action-card:hover {
    border-color: var(--accent);
    background: rgba(56,189,248,0.04);
    color: var(--text-primary);
}
.action-card .action-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.action-card .action-label {
    font-size: 13px;
    font-weight: 500;
}
.action-card .action-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* Tab badge */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    background: rgba(56,189,248,0.15);
    color: var(--accent);
    padding: 0 5px;
}

/* Copy button */
.copy-btn {
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 4px;
}
.code-badge-wrap { display: inline-flex; align-items: center; gap: 4px; }
.code-badge-wrap:hover .copy-btn { opacity: 1; }

/* Compose modal enhancements */
.char-count { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.char-count.over-limit { color: var(--accent-red); }

/* Checkbox for bulk actions */
.bulk-check { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Summary row at table bottom */
.summary-row td {
    font-weight: 600 !important;
    border-top: 2px solid var(--border-glow) !important;
    background: rgba(56,189,248,0.04);
}

/* Overdue pulse */
.overdue-pulse {
    animation: overdue-blink 2s infinite;
}
@keyframes overdue-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Funnel chart */
.funnel-step { text-align: center; margin-bottom: 4px; }
.funnel-bar {
    height: 28px;
    border-radius: 4px;
    margin: 0 auto 4px;
    transition: width 0.6s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.funnel-label { font-size: 11px; color: var(--text-muted); }

/* Insurance Deductions – Kanban */
.kanban-col { max-height: 500px; overflow-y: auto; scrollbar-width: thin; }
.kanban-card {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--border-color);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
}
.kanban-card:hover { background: rgba(255,255,255,0.06); transform: translateY(-1px); }

/* Insurance Deductions – Grid Cards */
.ded-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ded-grid-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
}
.ded-grid-card:hover { border-color: var(--accent); transform: translateY(-2px); }

/* Insurance Deductions – Row quick actions */
.ded-row-actions { opacity: 0; transition: opacity 0.2s; }
tr:hover .ded-row-actions { opacity: 1; }

/* Insurance Deductions – KPI glow on hover */
.kpi-glow:hover { box-shadow: 0 0 20px var(--glow-color, rgba(56,189,248,0.15)); }

/* Insurance Deductions – SLA pulsing dot */
.sla-pulse-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #e74c3c;
    animation: pulse-dot 2s infinite;
}

/* Column hide utility */
.col-hidden { display: none !important; }

/* Score threshold filter tabs */
.score-filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.score-filter-tabs .filter-btn { min-width: 80px; text-align: center; }

/* Enhanced table sort header */
.sortable-header { cursor: pointer; user-select: none; }
.sortable-header:hover { color: var(--accent); }

/* Provider expansion panel */
.provider-detail-panel {
    padding: 16px;
    background: rgba(56,189,248,0.02);
    border-top: 1px solid var(--border-color);
}

/* Sticky tab bar for patient detail */
.sticky-tabs {
    position: sticky;
    top: var(--topbar-height);
    z-index: 50;
    background: var(--bg-primary);
    padding-top: 4px;
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
}

/* Enhanced responsive */
@media (max-width: 767.98px) {
    .patient-card-grid {
        grid-template-columns: 1fr;
    }
    .action-bar {
        flex-direction: column;
    }
    .action-card {
        min-width: 100%;
    }
    .sticky-tabs {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ==========================================================================
   Template CMS
   ========================================================================== */

.tpl-preview-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    height: 100%;
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
}

.tpl-preview-subject {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    min-height: 40px;
    word-wrap: break-word;
}

.tpl-preview-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    min-height: 120px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.merge-field-highlight {
    display: inline;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.92em;
}

.merge-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.merge-palette-field {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-family: 'JetBrains Mono', monospace;
}

.merge-palette-field:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.tpl-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.tpl-status-dot.active { background: var(--accent-3); box-shadow: 0 0 6px var(--accent-3); }
.tpl-status-dot.inactive { background: var(--text-muted); }

.tpl-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.tpl-toggle input { opacity: 0; width: 0; height: 0; }

.tpl-toggle .slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: var(--transition);
}

.tpl-toggle .slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    transition: var(--transition);
}

.tpl-toggle input:checked + .slider { background: rgba(52, 211, 153, 0.3); }
.tpl-toggle input:checked + .slider::before { transform: translateX(16px); background: var(--accent-3); }

.tpl-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

@media (max-width: 767.98px) {
    .tpl-card-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Event Type Tab Pills (Nudge Events)
   ========================================================================== */

.event-type-tab {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.event-type-tab:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
    background: rgba(129, 140, 248, 0.06);
}

.event-type-tab.active {
    border-color: var(--accent-2);
    color: #fff;
    background: var(--accent-2);
}

/* ==========================================================================
   HIS Attribute Intelligence Engine
   ========================================================================== */

.tier-card { border-left: 3px solid var(--border-color); }
.tier-native { border-left-color: var(--accent-3); }
.tier-derived { border-left-color: var(--accent-2); }
.tier-ml { border-left-color: var(--accent); }
.tier-sdoh { border-left-color: var(--accent-amber); }

.his-confidence-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.his-confidence-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.his-confidence-fill.high { background: var(--accent-3); }
.his-confidence-fill.medium { background: var(--accent-amber); }
.his-confidence-fill.low { background: var(--accent-red); }

.risk-flag-red { color: var(--accent-red) !important; font-weight: 600; }
.risk-flag-amber { color: var(--accent-amber) !important; font-weight: 600; }
.risk-flag-green { color: var(--accent-3) !important; }

.flow-pipeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 16px 0;
    flex-wrap: wrap;
}
.flow-node {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    min-width: 120px;
}
.flow-node:hover { transform: translateY(-2px); }
.flow-node.native { background: rgba(52, 211, 153, 0.15); color: var(--accent-3); border: 1px solid rgba(52, 211, 153, 0.3); }
.flow-node.derived { background: rgba(129, 140, 248, 0.15); color: var(--accent-2); border: 1px solid rgba(129, 140, 248, 0.3); }
.flow-node.ml { background: rgba(56, 189, 248, 0.15); color: var(--accent); border: 1px solid rgba(56, 189, 248, 0.3); }
.flow-node.sdoh { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); border: 1px solid rgba(251, 191, 36, 0.3); }
.flow-node .flow-count { font-size: 20px; font-weight: 700; display: block; line-height: 1; margin-bottom: 2px; }
.flow-arrow {
    font-size: 20px;
    color: var(--text-muted);
    padding: 0 8px;
    display: flex;
    align-items: center;
}
.flow-engine {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(251, 191, 36, 0.1);
    border: 1px dashed rgba(251, 191, 36, 0.3);
    color: var(--accent-amber);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(129, 140, 248, 0.06);
    border: 1px solid rgba(129, 140, 248, 0.1);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}
.category-header:hover { background: rgba(129, 140, 248, 0.1); }
.category-header .cat-name { font-size: 13px; font-weight: 600; }
.category-header .cat-count { font-size: 11px; color: var(--text-muted); }
.category-header .cat-chevron { transition: transform 0.3s; font-size: 14px; }
.category-header.open .cat-chevron { transform: rotate(180deg); }
.category-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.category-body.open { max-height: 2000px; }

.attr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 12px;
    transition: var(--transition);
}
.attr-row:hover { background: rgba(56, 189, 248, 0.04); }
.attr-name-block { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.attr-name { color: var(--text-secondary); font-weight: 500; }
.attr-desc { color: var(--text-muted); font-size: 11px; font-weight: 400; line-height: 1.3; }
.attr-value { font-weight: 600; margin: 0 12px; min-width: 100px; text-align: right; white-space: nowrap; }
.attr-logic-btn {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.attr-logic-btn:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
    background: rgba(129, 140, 248, 0.1);
}

.ml-model-card {
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    transition: var(--transition);
}
.ml-model-card:hover { border-color: var(--border-glow); }
.ml-model-name { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ml-model-value { font-size: 22px; font-weight: 700; margin: 6px 0 4px; }
.ml-model-bar { margin-top: 8px; }

.his-native-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.his-native-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(52, 211, 153, 0.04);
    border: 1px solid rgba(52, 211, 153, 0.08);
}
.his-native-item .hn-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.his-native-item .hn-value { font-size: 13px; font-weight: 600; margin-top: 2px; word-break: break-word; }

/* ==========================================================================
   Nudge Config Center
   ========================================================================== */

/* Tabs */
.nc-tabs .nav-link {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 18px;
    margin-right: 6px;
    transition: var(--transition);
}
.nc-tabs .nav-link:hover { border-color: var(--border-glow); color: var(--text-primary); }
.nc-tabs .nav-link.active {
    background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(129,140,248,0.10));
    border-color: var(--accent);
    color: var(--accent);
}

/* Stat cards */
.nc-stat-card { text-align: center; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.nc-stat-val { font-size: 26px; font-weight: 700; }
.nc-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.nc-stat-types { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }

/* Event cards */
.nc-event-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: default;
}
.nc-event-card:hover { border-color: var(--border-glow); transform: translateY(-2px); }
.nc-event-card.nc-event-selected { border-color: var(--accent); box-shadow: 0 0 12px rgba(99,102,241,.25); background: rgba(99,102,241,.06); }
.nc-event-icon { font-size: 22px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: rgba(56,189,248,0.06); }

/* Type badges */
.nc-type-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.nc-type-clinical { background: rgba(56,189,248,0.15); color: var(--accent); }
.nc-type-engagement { background: rgba(129,140,248,0.15); color: var(--accent-2); }
.nc-type-administrative { background: rgba(52,211,153,0.15); color: var(--accent-3); }
.nc-type-financial { background: rgba(251,191,36,0.15); color: var(--accent-amber); }

/* Mapping accordion */
.nc-accordion .accordion-item { background: transparent; border: 1px solid var(--border-color); border-radius: var(--radius-sm) !important; margin-bottom: 8px; }
.nc-accordion .accordion-button { background: var(--bg-glass); color: var(--text-primary); font-size: 14px; padding: 12px 16px; border-radius: var(--radius-sm) !important; }
.nc-accordion .accordion-button:not(.collapsed) { background: rgba(56,189,248,0.06); }
.nc-accordion .accordion-button::after { filter: invert(1); }
.nc-accordion .accordion-body { background: var(--bg-card); }
.nc-mapping-row { border-bottom: 1px solid var(--border-color); }
.nc-mapping-row:last-child { border-bottom: none; }
.nc-mapping-row:hover { background: rgba(56,189,248,0.03); }

/* Rule cards */
.nc-rule-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}
.nc-rule-card:hover { border-color: var(--border-glow); }

/* Condition rows */
.nc-condition-row { padding: 6px 0; }
.nc-condition-row:not(:last-child) { border-bottom: 1px dashed rgba(100,116,139,0.2); }

/* Xs buttons */
.btn-xs { padding: 2px 6px; font-size: 11px; }

/* Glass modal */
.glass-modal { background: var(--bg-secondary); border: 1px solid var(--border-color); }
.glass-modal .modal-header { padding: 16px 20px; }
.glass-modal .modal-body { padding: 12px 20px; }
.glass-modal .modal-footer { padding: 12px 20px; }

/* Glass table wrap */
.glass-table-wrap { border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; }
.glass-table-wrap .table { margin-bottom: 0; }
.glass-table-wrap .table thead th { background: var(--bg-glass); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom-color: var(--border-color); }
.glass-table-wrap .table td { border-bottom-color: var(--border-color); font-size: 13px; vertical-align: middle; }

/* Acc item */
.nc-acc-item { overflow: hidden; }

/* ==========================================================================
   Scoring Config — Weight Bar
   ========================================================================== */

.sc-weight-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.form-range::-webkit-slider-thumb { background: var(--accent); }
.form-range::-moz-range-thumb { background: var(--accent); border: none; }
.form-range::-webkit-slider-runnable-track { background: rgba(56, 189, 248, 0.15); border-radius: 4px; }
.form-range::-moz-range-track { background: rgba(56, 189, 248, 0.15); border-radius: 4px; }

/* ==========================================================================
   Sidebar Section Headers
   ========================================================================== */

.nav-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 14px 4px;
    margin-top: 4px;
    list-style: none;
}

/* ==========================================================================
   Notification Center
   ========================================================================== */

.notif-count-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--accent-red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.notification-panel.open {
    right: 0;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.notif-filter-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.notif-filter-tabs button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 12px;
    transition: var(--transition);
    cursor: pointer;
}

.notif-filter-tabs button:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.2);
    color: var(--accent);
}

.notif-filter-tabs button.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.notif-item {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.04);
    cursor: pointer;
    transition: var(--transition);
}

.notif-item:hover {
    background: rgba(56, 189, 248, 0.04);
}

.notif-item.unread {
    border-left: 3px solid var(--accent);
    background: rgba(56, 189, 248, 0.02);
}

.notif-priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

/* ==========================================================================
   Chat Bubbles — AI Copilot
   ========================================================================== */

.chat-msg {
    margin-bottom: 16px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.chat-avatar.user {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 12px 12px 12px 2px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}

.chat-bubble.user {
    border-radius: 12px 12px 2px 12px;
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   SDOH Cards
   ========================================================================== */

.sdoh-factor-card {
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    text-align: center;
}

.sdoh-factor-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.sdoh-factor-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sdoh-factor-value {
    font-size: 18px;
    font-weight: 700;
    margin-top: 2px;
}

/* ==========================================================================
   Additional Status Badges
   ========================================================================== */

.badge-scheduled { background: rgba(129, 140, 248, 0.15); color: var(--accent-2); }
.badge-no-show { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }
.badge-draft { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.badge-paused { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.badge-cancelled { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }

/* Override sidebar overflow for scrolling with many items */
.sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* ==========================================================================
   Guided Journeys
   ========================================================================== */

.journey-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.journey-card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.08);
    transform: translateY(-2px);
}
.journey-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.journey-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(56, 189, 248, 0.08);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.journey-meta { display: flex; align-items: center; gap: 8px; }
.journey-card-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.journey-card-desc { font-size: 12px; color: var(--text-secondary); flex-grow: 1; margin-bottom: 12px; }
.journey-card-impact {
    background: rgba(0,0,0,0.2); border-radius: var(--radius-sm);
    padding: 10px; margin-bottom: 12px;
}
.impact-label { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.impact-value { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.impact-sublabel { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.journey-card-action {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; font-weight: 600; color: var(--accent);
    padding-top: 12px; border-top: 1px solid var(--border-color);
}

/* --- Stepper --- */
.stepper-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0; position: relative;
    transition: var(--transition);
}
.stepper-item:not(:last-child)::after {
    content: ''; position: absolute; left: 13px; top: 34px;
    width: 2px; height: calc(100% - 26px);
    background: var(--border-color);
}
.stepper-item.complete:not(:last-child)::after { background: var(--accent-3); }
.stepper-indicator {
    width: 28px; height: 28px; min-width: 28px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; z-index: 1;
    background: var(--bg-secondary); border: 2px solid var(--border-color); color: var(--text-muted);
    transition: var(--transition);
}
.stepper-item.active .stepper-indicator {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}
.stepper-item.complete .stepper-indicator {
    background: var(--accent-3); border-color: var(--accent-3); color: #fff;
}
.stepper-title { font-size: 12px; font-weight: 600; line-height: 1.3; }
.stepper-desc { font-size: 10px; color: var(--text-muted); line-height: 1.3; }
.stepper-item.active .stepper-title { color: var(--accent); }
.stepper-item.complete .stepper-title { color: var(--accent-3); }
.stepper-item:hover .stepper-indicator { border-color: var(--accent); }

/* --- Chat bubbles --- */
.chat-assistant .chat-bubble {
    background: rgba(56, 189, 248, 0.06); border: 1px solid var(--border-color);
}
.chat-user { text-align: right; }
.chat-user .chat-bubble { display: inline-block; text-align: left; }

/* --- Floating journey button --- */
.journey-fab {
    position: fixed; bottom: 24px; right: 24px; z-index: 1050;
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: none; color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
    cursor: pointer; transition: var(--transition);
}
.journey-fab:hover { transform: scale(1.1); box-shadow: 0 4px 28px rgba(56, 189, 248, 0.4); }
.journey-fab-popup {
    position: fixed; bottom: 80px; right: 24px; z-index: 1049;
    width: 300px; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    display: none;
}
.journey-fab-popup.open { display: block; }
.journey-fab-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition);
    font-size: 12px; margin-bottom: 4px;
}
.journey-fab-item:hover { background: rgba(56, 189, 248, 0.08); }
.journey-fab-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(56, 189, 248, 0.08);
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.journey-fab-impact { font-size: 10px; color: var(--accent-amber); font-weight: 600; }

/* ==========================================================================
   Channel Filter Tabs & RFM Score Circles
   ========================================================================== */

.channel-filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.channel-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.channel-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

.channel-filter-btn.active {
    border-color: var(--accent);
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.channel-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
}

.channel-filter-btn.active .channel-count-badge {
    background: rgba(255, 255, 255, 0.25);
}

/* RFM Score Circles */
.rfm-score-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid;
}

.rfm-score-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
    border: 3px solid;
}

.rfm-score-5, .rfm-score-4 {
    border-color: var(--accent-3);
    color: var(--accent-3);
    background: rgba(52, 211, 153, 0.1);
}

.rfm-score-3 {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
}

.rfm-score-2 {
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    background: rgba(251, 191, 36, 0.1);
}

.rfm-score-1 {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.1);
}

/* Consent badges */
.consent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.consent-badge.opted-in {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-3);
}

.consent-badge.opted-out {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

/* ML Attribute card */
.ml-attr-card {
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    text-align: center;
    transition: var(--transition);
}

.ml-attr-card:hover {
    border-color: var(--border-glow);
}

.ml-attr-icon {
    font-size: 18px;
    margin-bottom: 4px;
    opacity: 0.7;
}

.ml-attr-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.ml-attr-value {
    font-size: 16px;
    font-weight: 700;
}

/* Consent coverage bar */
.consent-coverage-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================================================
   Global — Brighter text & larger font overrides
   ========================================================================== */

/* Override Bootstrap .text-muted to be brighter */
.content-area .text-muted,
.content-area .text-muted-custom {
    color: var(--text-muted) !important;
}

/* Form labels — larger + white */
.content-area .form-label {
    font-size: 13px;
    color: var(--text-primary);
}

/* Detail item labels (used in stat grids / modal detail views) */
.di-label {
    color: var(--text-secondary) !important;
    font-size: 12px;
}
.di-value {
    color: #ffffff !important;
}

/* Pagination text */
.content-area .page-link {
    font-size: 13px;
    color: var(--text-primary);
}

/* Small helper text — ensure minimum readability */
.content-area small,
.content-area .small {
    color: var(--text-secondary);
}

/* Nudge Intelligence — Horizontal Funnel */
.nudge-funnel-h .funnel-step { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.nudge-funnel-h .funnel-bar { height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; transition: width 0.6s ease; min-width: 36px; }
.nudge-funnel-h .funnel-label { font-size: 11px; color: var(--text-muted); min-width: 70px; text-align: right; }
.nudge-funnel-h .funnel-drop { font-size: 9px; color: var(--accent-red); min-width: 36px; text-align: center; }
.nudge-funnel-h .funnel-count { font-size: 11px; font-weight: 600; min-width: 36px; }

/* Nudge Intelligence — EAST Heatmap */
.east-cell { border-radius: 8px; padding: 12px; background: rgba(255,255,255,0.03); transition: transform 0.2s; }
.east-cell:hover { transform: translateY(-2px); }
.east-cell .east-rate { font-size: 22px; font-weight: 700; line-height: 1; }
.east-cell .east-label { font-size: 10px; color: var(--text-muted); }

/* Nudge Intelligence — Funnel mini icons in table */
.funnel-icons { display: inline-flex; gap: 3px; }
.funnel-icons i { font-size: 11px; transition: opacity 0.3s; }
.funnel-icons i.active { opacity: 1; }
.funnel-icons i.inactive { opacity: 0.15; }

/* ===== Workflow Automation Builder — SciKIQ Professional Theme ===== */

/* Scoped variables — only affect workflow builder */
#builderView {
    --wf-accent: #FF9900;
    --wf-accent-light: #FFB800;
    --wf-accent-glow: rgba(255,153,0,0.25);
    --wf-bg-dark: #0a0e13;
    --wf-node-bg: linear-gradient(135deg, rgba(44,65,105,0.9), rgba(22,33,62,0.9));
    --wf-node-border: rgba(255,255,255,0.08);
    --wf-node-width: 220px;
    --wf-grid-size: 40px;
    --wf-panel-bg: rgba(15,20,25,0.85);
    --wf-glass-blur: 16px;
    --wf-conn-color: #FF9900;
}

/* ── Canvas ── */
.wf-canvas {
    position: relative;
    background:
        radial-gradient(circle at 50% 40%, rgba(255,153,0,0.03) 0%, transparent 60%),
        radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px;
    min-height: 650px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0;
    overflow: hidden;
    cursor: default;
    background-color: var(--wf-bg-dark, #0a0e13);
}
.wf-canvas svg.wf-svg {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 1;
}
.wf-canvas svg.wf-svg path {
    fill: none;
    stroke: var(--wf-conn-color, #FF9900);
    stroke-width: 2.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(255,153,0,0.3));
    transition: stroke 0.2s, stroke-width 0.15s, filter 0.15s;
    pointer-events: stroke;
    cursor: pointer;
}
.wf-canvas svg.wf-svg path:hover {
    stroke-width: 3.5;
    filter: drop-shadow(0 0 8px rgba(255,153,0,0.5));
}
.wf-canvas svg.wf-svg path.wf-conn-yes { stroke: #34d399; filter: drop-shadow(0 0 4px rgba(52,211,153,0.3)); }
.wf-canvas svg.wf-svg path.wf-conn-yes:hover { filter: drop-shadow(0 0 8px rgba(52,211,153,0.5)); }
.wf-canvas svg.wf-svg path.wf-conn-no  { stroke: #f87171; filter: drop-shadow(0 0 4px rgba(248,113,113,0.3)); }
.wf-canvas svg.wf-svg path.wf-conn-no:hover  { filter: drop-shadow(0 0 8px rgba(248,113,113,0.5)); }
.wf-canvas svg.wf-svg path.wf-conn-active { stroke: var(--wf-conn-color); stroke-width: 2.5; }

/* ── Nodes — 220px gradient cards ── */
.wf-node {
    position: absolute;
    width: 220px;
    min-height: 80px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(44,65,105,0.92), rgba(22,33,62,0.92));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    cursor: grab;
    z-index: 2;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    font-size: 12px;
    user-select: none;
    backdrop-filter: blur(12px);
    /* 3-layer shadow: border glow + depth + ambient */
    box-shadow:
        0 0 0 0 transparent,
        0 4px 12px rgba(0,0,0,0.35),
        0 12px 28px rgba(0,0,0,0.15);
}
.wf-node:hover {
    border-color: var(--wf-accent);
    box-shadow:
        0 0 12px rgba(255,153,0,0.12),
        0 6px 16px rgba(0,0,0,0.35),
        0 16px 32px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
.wf-node:focus-visible, .wf-node:focus {
    outline: 2px solid var(--wf-accent);
    outline-offset: 2px;
}
.wf-node.selected {
    border-color: var(--wf-accent);
    border-width: 2px;
    box-shadow:
        0 0 20px rgba(255,153,0,0.2),
        0 6px 16px rgba(0,0,0,0.35),
        0 16px 32px rgba(0,0,0,0.15);
}
.wf-node.dragging {
    cursor: grabbing; opacity: 0.92; z-index: 10; transform: none;
    box-shadow:
        0 0 16px rgba(255,153,0,0.15),
        0 12px 32px rgba(0,0,0,0.5),
        0 24px 48px rgba(0,0,0,0.2);
}
.wf-node .wf-node-icon { margin-right: 6px; font-size: 14px; }
.wf-node .wf-node-title { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-node .wf-node-sub { font-size: 10px; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-node .wf-node-type-label { font-size: 9px; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* Node icon circle */
.wf-node-icon-circle {
    width: 32px; height: 32px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0; margin-right: 10px;
}
.wf-node-icon-circle.ic-trigger    { background: rgba(251,191,36,0.15); color: #fbbf24; }
.wf-node-icon-circle.ic-wait       { background: rgba(52,211,153,0.15); color: #34d399; }
.wf-node-icon-circle.ic-delay_until { background: rgba(45,212,191,0.15); color: #2dd4bf; }
.wf-node-icon-circle.ic-send       { background: rgba(56,189,248,0.15); color: #38bdf8; }
.wf-node-icon-circle.ic-condition  { background: rgba(167,139,250,0.15); color: #a78bfa; }
.wf-node-icon-circle.ic-ab_split   { background: rgba(251,146,60,0.15); color: #fb923c; }
.wf-node-icon-circle.ic-segment    { background: rgba(244,114,182,0.15); color: #f472b6; }
.wf-node-icon-circle.ic-update_field { background: rgba(163,230,53,0.15); color: #a3e635; }
.wf-node-icon-circle.ic-webhook    { background: rgba(232,121,249,0.15); color: #e879f9; }
.wf-node-icon-circle.ic-end        { background: rgba(248,113,113,0.15); color: #f87171; }
.wf-node-icon-circle.ic-loop       { background: rgba(249,115,22,0.15); color: #f97316; }
.wf-node-icon-circle.ic-switch_case { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.wf-node-icon-circle.ic-parallel   { background: rgba(236,72,153,0.15); color: #ec4899; }
.wf-node-icon-circle.ic-human_task { background: rgba(20,184,166,0.15); color: #14b8a6; }

/* Status dot */
.wf-status-dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.4);
}

/* Condition node diamond decoration */
.wf-node.type-condition { background: transparent; backdrop-filter: none; box-shadow: none; min-height: 110px; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.wf-node.type-condition::before {
    content: '';
    position: absolute;
    top: 10px; left: 50%;
    width: 110px; height: 110px;
    background: linear-gradient(135deg, rgba(44,65,105,0.9), rgba(22,33,62,0.9));
    border: 1px solid rgba(255,255,255,0.08);
    transform: translateX(-50%) rotate(45deg);
    border-radius: 8px;
    z-index: -1;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.wf-node.type-condition:hover::before { border-color: var(--wf-accent); box-shadow: 0 4px 20px rgba(255,153,0,0.15); }
.wf-node.type-condition.selected::before { border-color: var(--wf-accent); border-width: 2px; box-shadow: 0 0 24px rgba(255,153,0,0.25); }

/* ── Ports ── */
.wf-port {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(10,14,19,0.8);
    position: absolute;
    cursor: crosshair;
    z-index: 3;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.wf-port:hover { background: var(--wf-accent); transform: scale(1.3); box-shadow: 0 0 8px rgba(255,153,0,0.4); }
.wf-port.input  { top: -6px; left: 50%; transform: translateX(-50%); }
.wf-port.input:hover { transform: translateX(-50%) scale(1.3); }
.wf-port.output { bottom: -6px; left: 50%; transform: translateX(-50%); }
.wf-port.output:hover { transform: translateX(-50%) scale(1.3); }
.wf-port.output-yes { bottom: -6px; left: 30%; transform: translateX(-50%); }
.wf-port.output-yes:hover { transform: translateX(-50%) scale(1.3); }
.wf-port.output-no  { bottom: -6px; left: 70%; transform: translateX(-50%); }
.wf-port.output-no:hover { transform: translateX(-50%) scale(1.3); }
.wf-port-label {
    position: absolute; font-size: 9px; font-weight: 600; bottom: -18px;
    transform: translateX(-50%); transition: font-size 0.15s, opacity 0.15s;
    opacity: 0.7; pointer-events: none;
}
.wf-node:hover .wf-port-label { opacity: 1; font-size: 10px; }
.wf-port-label.yes { left: 30%; color: #34d399; }
.wf-port-label.no  { left: 70%; color: #f87171; }

/* ── Left Palette — 320px glassmorphic ── */
.wf-palette {
    width: 320px;
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 0;
    flex-shrink: 0;
    background: var(--wf-panel-bg, rgba(15,20,25,0.85));
    backdrop-filter: blur(16px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.wf-palette-header {
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 14px; font-weight: 700; color: var(--text-color);
    display: flex; align-items: center; gap: 8px;
}
.wf-palette-header i { color: var(--wf-accent); font-size: 16px; }
.wf-palette-search {
    padding: 8px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.wf-palette-search input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 7px 12px 7px 32px;
    color: var(--text-color);
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.wf-palette-search input:focus { border-color: var(--wf-accent); }
.wf-palette-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-palette-search { position: relative; }
.wf-palette-search .search-icon {
    position: absolute; left: 28px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 12px; pointer-events: none;
}
.wf-palette-body { padding: 8px 12px; flex: 1; overflow-y: auto; }

/* Palette sections */
.wf-pal-section {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 6px 6px;
    cursor: pointer;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--text-muted); opacity: 0.7;
    user-select: none;
    transition: opacity 0.2s;
}
.wf-pal-section:hover { opacity: 1; }
.wf-pal-section .chevron { transition: transform 0.2s; font-size: 10px; }
.wf-pal-section.collapsed .chevron { transform: rotate(-90deg); }
.wf-pal-group { overflow: hidden; transition: max-height 0.3s ease; }
.wf-pal-section.collapsed + .wf-pal-group { max-height: 0 !important; overflow: hidden; }

/* Palette items */
.wf-palette-item {
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    cursor: grab;
    margin-bottom: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    background: rgba(255,255,255,0.02);
}
.wf-palette-item:hover {
    border-color: var(--wf-accent);
    background: rgba(255,153,0,0.04);
    box-shadow: 0 0 12px rgba(255,153,0,0.08);
}
.wf-palette-item .pal-icon-circle {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.pal-icon-circle.ic-trigger    { background: rgba(251,191,36,0.15); color: #fbbf24; }
.pal-icon-circle.ic-wait       { background: rgba(52,211,153,0.15); color: #34d399; }
.pal-icon-circle.ic-delay_until { background: rgba(45,212,191,0.15); color: #2dd4bf; }
.pal-icon-circle.ic-send       { background: rgba(56,189,248,0.15); color: #38bdf8; }
.pal-icon-circle.ic-condition  { background: rgba(167,139,250,0.15); color: #a78bfa; }
.pal-icon-circle.ic-ab_split   { background: rgba(251,146,60,0.15); color: #fb923c; }
.pal-icon-circle.ic-segment    { background: rgba(244,114,182,0.15); color: #f472b6; }
.pal-icon-circle.ic-update_field { background: rgba(163,230,53,0.15); color: #a3e635; }
.pal-icon-circle.ic-webhook    { background: rgba(232,121,249,0.15); color: #e879f9; }
.pal-icon-circle.ic-end        { background: rgba(248,113,113,0.15); color: #f87171; }
.pal-icon-circle.ic-loop       { background: rgba(249,115,22,0.15); color: #f97316; }
.pal-icon-circle.ic-switch_case { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.pal-icon-circle.ic-parallel   { background: rgba(236,72,153,0.15); color: #ec4899; }
.pal-icon-circle.ic-human_task { background: rgba(20,184,166,0.15); color: #14b8a6; }
.pal-icon-circle.ic-ch-email   { background: rgba(56,189,248,0.15); color: #38bdf8; }
.pal-icon-circle.ic-ch-sms     { background: rgba(52,211,153,0.15); color: #34d399; }
.pal-icon-circle.ic-ch-whatsapp { background: rgba(37,211,102,0.15); color: #25d366; }
.pal-icon-circle.ic-ch-phone   { background: rgba(251,191,36,0.15); color: #fbbf24; }

.wf-palette-item .pal-text { display: flex; flex-direction: column; min-width: 0; }
.wf-palette-item .pal-name { font-weight: 600; font-size: 12px; color: var(--text-color); }
.wf-palette-item .pal-desc { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Properties Panel — 340px glassmorphic ── */
.wf-props-panel {
    width: 340px;
    border-left: 1px solid rgba(255,255,255,0.06);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    font-size: 13px;
    background: var(--wf-panel-bg, rgba(15,20,25,0.85));
    backdrop-filter: blur(16px);
}
.wf-props-panel .form-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.wf-props-panel .form-control, .wf-props-panel .form-select {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
    color: var(--text-color);
    font-size: 12px;
}
.wf-props-panel .form-control:focus, .wf-props-panel .form-select:focus {
    border-color: var(--wf-accent);
    box-shadow: 0 0 0 3px rgba(255,153,0,0.12);
}
.wf-props-panel .prop-section-hdr {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--wf-accent); margin: 12px 0 6px; padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,153,0,0.15);
}
.wf-props-panel select optgroup { font-weight: 600; color: var(--text-muted); font-size: 11px; }

/* ── Top Bar — Gradient header with orange glow ── */
.wf-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 2px solid var(--wf-accent);
    background: linear-gradient(135deg, rgba(15,20,25,0.95), rgba(10,14,19,0.98));
    backdrop-filter: blur(16px);
    position: relative;
}
.wf-topbar::after {
    content: '';
    position: absolute; bottom: -2px; left: 0; right: 0;
    height: 8px;
    background: linear-gradient(to bottom, rgba(255,153,0,0.15), transparent);
    pointer-events: none;
}
.wf-topbar input.wf-name-input {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    flex: 1;
    min-width: 0;
}
.wf-topbar input.wf-name-input:hover { border-color: rgba(255,255,255,0.1); }
.wf-topbar input.wf-name-input:focus { border-color: var(--wf-accent); outline: none; }
.wf-topbar input.wf-name-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-topbar .btn-primary, .wf-topbar .btn-success {
    background: var(--wf-accent) !important;
    border-color: var(--wf-accent) !important;
    color: #0a0e13 !important;
    font-weight: 600;
}
.wf-topbar .btn-primary:hover, .wf-topbar .btn-success:hover {
    background: var(--wf-accent-light) !important;
    border-color: var(--wf-accent-light) !important;
}

/* Workflow status badges */
.wf-status { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.wf-status.active  { background: rgba(16,185,129,0.15); color: #34d399; }
.wf-status.draft   { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.wf-status.paused  { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ── Builder Layout ── */
.wf-builder-wrap {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 600px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
    background: var(--wf-bg-dark, #0a0e13);
}

/* ── Connection temp line ── */
.wf-temp-line {
    stroke: var(--wf-conn-color, #FF9900);
    stroke-width: 2;
    stroke-dasharray: 6 3;
    filter: drop-shadow(0 0 4px rgba(255,153,0,0.3));
}

/* ── Node validation indicator ── */
.wf-node.invalid { border-color: var(--accent-red) !important; box-shadow: 0 0 16px rgba(248,113,113,0.2) !important; }
.wf-node.invalid::after {
    content: '!';
    position: absolute; top: -8px; right: -8px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent-red); color: #fff;
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}
.wf-node.type-condition.invalid::before { border-color: var(--accent-red) !important; box-shadow: 0 0 16px rgba(248,113,113,0.2) !important; }

/* Snap-to-grid visual indicator on node */
.wf-node.snapping { transition: left 0.08s ease, top 0.08s ease; }

/* Alignment guides */
.wf-align-guide {
    position: absolute; z-index: 0; pointer-events: none;
}
.wf-align-v {
    width: 1px !important; background: rgba(255,153,0,0.35);
    box-shadow: 0 0 4px rgba(255,153,0,0.25);
}
.wf-align-h {
    height: 1px !important; background: rgba(255,153,0,0.35);
    box-shadow: 0 0 4px rgba(255,153,0,0.25);
}

/* Port glow during connection (valid targets) */
.wf-port.port-glow {
    background: var(--wf-accent) !important;
    box-shadow: 0 0 10px rgba(255,153,0,0.6), 0 0 20px rgba(255,153,0,0.2);
    animation: portPulse 1s ease-in-out infinite;
}
@keyframes portPulse {
    0%,100% { box-shadow: 0 0 6px rgba(255,153,0,0.4); }
    50% { box-shadow: 0 0 14px rgba(255,153,0,0.7), 0 0 24px rgba(255,153,0,0.3); }
}

/* Minimap viewport indicator */
.mm-viewport {
    position: absolute; border: 1px solid rgba(255,153,0,0.5);
    background: rgba(255,153,0,0.06); border-radius: 2px; pointer-events: none;
}
.wf-minimap { cursor: pointer; }

/* Drop zone highlight */
.wf-canvas.drag-over { outline: 2px dashed var(--wf-accent); outline-offset: -4px; }

/* Drag ghost preview */
.wf-drag-ghost {
    background: rgba(10,14,19,0.95); border: 1px solid var(--wf-accent);
    border-radius: 8px; padding: 6px 14px; font-size: 12px; font-weight: 600;
    color: var(--text-color); white-space: nowrap; display: flex; align-items: center; gap: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.wf-drag-ghost i { color: var(--wf-accent); }

/* ── AB Split dual output ports ── */
.wf-port.output-a { bottom: -6px; left: 30%; transform: translateX(-50%); }
.wf-port.output-a:hover { transform: translateX(-50%) scale(1.3); }
.wf-port.output-b { bottom: -6px; left: 70%; transform: translateX(-50%); }
.wf-port.output-b:hover { transform: translateX(-50%) scale(1.3); }
.wf-port-label.a { left: 30%; color: #38bdf8; }
.wf-port-label.b { left: 70%; color: #fb923c; }

/* ── Context Menu — glassmorphic ── */
.wf-ctx-menu {
    position: fixed; z-index: 9999;
    background: rgba(10,14,19,0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 4px 0;
    min-width: 170px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    font-size: 12px;
}
.wf-ctx-menu .ctx-item {
    padding: 8px 16px; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    color: var(--text-color); transition: background 0.15s, color 0.15s;
}
.wf-ctx-menu .ctx-item:hover { background: rgba(255,153,0,0.1); color: var(--wf-accent); }
.wf-ctx-menu .ctx-item.danger { color: var(--accent-red); }
.wf-ctx-menu .ctx-item.danger:hover { background: rgba(248,113,113,0.1); }
.wf-ctx-menu .ctx-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }

/* ── Zoom Controls ── */
.wf-zoom-ctrl {
    position: absolute; bottom: 12px; right: 12px; z-index: 10;
    display: flex; flex-direction: column; gap: 4px;
}
.wf-zoom-ctrl button {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(10,14,19,0.9); border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-color); font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    backdrop-filter: blur(8px);
}
.wf-zoom-ctrl button:hover { background: rgba(255,153,0,0.1); border-color: var(--wf-accent); }
.wf-zoom-label { font-size: 9px; text-align: center; color: var(--text-muted); }

/* ── Minimap ── */
.wf-minimap {
    position: absolute; bottom: 12px; left: 12px; z-index: 10;
    width: 150px; height: 100px;
    background: rgba(10,14,19,0.9); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; overflow: hidden; cursor: pointer;
    backdrop-filter: blur(8px);
}
.wf-minimap .mm-node {
    position: absolute; border-radius: 3px; opacity: 0.8;
}
/* Minimap node type colors */
.wf-minimap .mm-node.mm-trigger   { background: #f59e0b !important; }
.wf-minimap .mm-node.mm-condition { background: #8b5cf6 !important; }
.wf-minimap .mm-node.mm-send      { background: #10b981 !important; }
.wf-minimap .mm-node.mm-wait      { background: #06b6d4 !important; }
.wf-minimap .mm-node.mm-action    { background: #3b82f6 !important; }
.wf-minimap .mm-node.mm-end       { background: #6b7280 !important; }
.wf-minimap .mm-node.mm-ab_split  { background: #f97316 !important; }
.wf-minimap .mm-node.mm-segment   { background: #ec4899 !important; }
.wf-minimap .mm-viewport {
    position: absolute; border: 1px solid var(--wf-accent); border-radius: 2px;
    background: rgba(255,153,0,0.05); pointer-events: none;
}

/* ── Template preview card ── */
.wf-tpl-preview {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px; padding: 10px; margin-top: 8px; font-size: 11px;
}
.wf-tpl-preview .tpl-subj { font-weight: 600; margin-bottom: 4px; color: var(--text-color); }
.wf-tpl-preview .tpl-body { color: var(--text-muted); max-height: 80px; overflow: hidden; }

/* Incomplete config badge */
.wf-config-badge {
    position: absolute; top: -6px; right: -6px; z-index: 5;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(251,191,36,0.9); color: #1a1a2e;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; box-shadow: 0 2px 8px rgba(251,191,36,0.4);
    animation: wfBadgePulse 2s infinite;
}
@keyframes wfBadgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* Cohort badge in segment node */
.wf-cohort-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(244,114,182,0.12); color: #f472b6;
    font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 12px;
    margin-top: 4px;
}

/* AB ratio bar */
.wf-ab-ratio {
    display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 6px; width: 100%;
}
.wf-ab-ratio .ab-a { background: #38bdf8; }
.wf-ab-ratio .ab-b { background: #fb923c; }

/* ── Connection arrow markers ── */
.wf-canvas svg.wf-svg marker path { fill: #FF9900; stroke: none; }
.wf-canvas svg.wf-svg marker.wf-marker-yes path { fill: #34d399; }
.wf-canvas svg.wf-svg marker.wf-marker-no path  { fill: #f87171; }
.wf-canvas svg.wf-svg marker.wf-marker-a path   { fill: #38bdf8; }
.wf-canvas svg.wf-svg marker.wf-marker-b path   { fill: #fb923c; }

/* ── Animated connection flow ── */
@keyframes wf-flow { to { stroke-dashoffset: -20; } }
.wf-canvas svg.wf-svg path.wf-animated {
    stroke-dasharray: 8 4;
    animation: wf-flow 1.2s linear infinite;
}

/* ── Branch labels on connections ── */
.wf-branch-label {
    font-size: 9px; font-weight: 700; fill: #fff;
    text-anchor: middle; dominant-baseline: central;
    pointer-events: none;
}
.wf-branch-rect {
    rx: 4; ry: 4; pointer-events: none;
}
.wf-branch-rect.br-yes { fill: #059669; }
.wf-branch-rect.br-no  { fill: #dc2626; }
.wf-branch-rect.br-a   { fill: #0284c7; }
.wf-branch-rect.br-b   { fill: #c2410c; }

/* ── Kbd shortcuts hint bar ── */
.wf-kbd-bar {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    z-index: 10; font-size: 10px; color: var(--text-muted); opacity: 0.5;
    pointer-events: none; white-space: nowrap;
}
.wf-kbd-bar kbd {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px; padding: 1px 5px; font-size: 9px; color: var(--text-muted);
}

/* ── Connection info tooltip on hover ── */
.wf-conn-tooltip {
    position: absolute; z-index: 20;
    background: rgba(10,14,19,0.95); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px;
    padding: 4px 10px; font-size: 10px; color: var(--text-color);
    pointer-events: none; white-space: nowrap;
    backdrop-filter: blur(8px);
}

/* ── Workflow Integration Components ── */

.wf-etype-badge {
    display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px;
    border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.etype-clinical    { background: rgba(56,189,248,0.15); color: #38bdf8; }
.etype-administrative { background: rgba(251,191,36,0.15); color: #fbbf24; }
.etype-engagement  { background: rgba(52,211,153,0.15); color: #34d399; }
.etype-financial   { background: rgba(248,113,113,0.15); color: #f87171; }

.wf-east-pill {
    display: inline-block; font-size: 9px; font-weight: 600; padding: 1px 7px;
    border: 1px solid; border-radius: 8px; text-transform: uppercase; letter-spacing: 0.3px;
}

.wf-behavioral-badge {
    display: inline-block; font-size: 10px; padding: 2px 8px;
    background: rgba(167,139,250,0.15); color: #a78bfa;
    border-radius: 8px; font-style: italic;
}

.wf-trigger-stat {
    font-size: 11px; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 4px;
}
.wf-trigger-stat i { font-size: 12px; }

.wf-detection-result {
    background: rgba(56,189,248,0.06); border: 1px solid rgba(56,189,248,0.15);
    border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.wf-detection-count {
    font-weight: 600; font-size: 13px; color: var(--accent); margin-bottom: 4px;
}
.wf-det-patient {
    font-size: 11px; color: var(--text-secondary); padding: 1px 0;
}

.wf-rule-item {
    padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.wf-rule-item:last-child { border-bottom: none; }
.wf-rule-active {
    font-size: 9px; font-weight: 600; padding: 1px 6px;
    background: rgba(52,211,153,0.15); color: #34d399; border-radius: 6px;
}
.wf-rule-inactive {
    font-size: 9px; font-weight: 600; padding: 1px 6px;
    background: rgba(248,113,113,0.1); color: #f87171; border-radius: 6px;
}

.wf-int-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.wf-int-green  { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.4); }
.wf-int-yellow { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.4); }
.wf-int-gray   { background: #6b7280; }
.wf-int-none   { background: #374151; opacity: 0.5; }

/* @keyframes spin — removed duplicate, see first declaration above */
.spin { animation: spin 0.8s linear infinite; display: inline-block; }

/* ── Workflow Sidebar Tabs (Assistant / Journeys / Nudges / Configure) ── */
.wf-sidebar-tabs {
    display: flex; border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0; background: rgba(10,14,19,0.6);
}
.wf-sidebar-tab {
    flex: 1; padding: 8px 2px; text-align: center; cursor: pointer;
    font-size: 9px; font-weight: 600; color: var(--text-muted);
    border: none; background: none; transition: color 0.2s, box-shadow 0.2s;
    text-transform: uppercase; letter-spacing: 0.3px; position: relative;
}
.wf-sidebar-tab:hover { color: var(--text-color); }
.wf-sidebar-tab.active { color: var(--wf-accent); box-shadow: inset 0 -2px 0 var(--wf-accent); }
.wf-sidebar-tab i { display: block; font-size: 14px; margin-bottom: 1px; }

.wf-tab-pane { display: none; flex-direction: column; flex: 1; min-height: 0; padding: 16px; }
.wf-tab-pane.active { display: flex; }

/* ── Chat Tab ── */
.wf-chat-messages {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column;
    gap: 12px; padding-bottom: 8px; min-height: 0;
}
.wf-chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.wf-chat-msg.user { flex-direction: row-reverse; }
.wf-chat-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.wf-chat-msg.assistant .wf-chat-avatar {
    background: linear-gradient(135deg, rgba(255,153,0,0.25), rgba(251,191,36,0.15));
    color: var(--wf-accent);
}
.wf-chat-msg.user .wf-chat-avatar {
    background: rgba(56,189,248,0.15); color: #38bdf8;
}
.wf-chat-bubble {
    max-width: 85%; padding: 8px 12px; border-radius: 12px;
    font-size: 12px; line-height: 1.5; word-wrap: break-word;
}
.wf-chat-msg.assistant .wf-chat-bubble {
    background: rgba(255,255,255,0.04); color: var(--text-color);
    border-bottom-left-radius: 4px;
}
.wf-chat-msg.user .wf-chat-bubble {
    background: rgba(255,153,0,0.12); color: var(--text-color);
    border-bottom-right-radius: 4px;
}
.wf-chat-bubble p { margin: 0 0 6px; }
.wf-chat-bubble p:last-child { margin-bottom: 0; }
.wf-chat-bubble strong { color: var(--wf-accent); font-weight: 600; }
.wf-chat-bubble code {
    background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px;
    font-size: 11px;
}

/* Quick action pills */
.wf-quick-actions {
    display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 0; flex-shrink: 0;
    max-height: 210px; overflow-y: auto;
}
.wf-qa-section-label {
    width: 100%; font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px;
    color: rgba(255,255,255,0.3); font-weight: 700; padding: 2px 0;
}
.wf-quick-action {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 14px; font-size: 10.5px; font-weight: 500;
    cursor: pointer; border: 1px solid rgba(255,153,0,0.25); color: var(--wf-accent);
    background: rgba(255,153,0,0.06); transition: all 0.2s; white-space: nowrap;
}
.wf-quick-action i { font-size: 10px; opacity: 0.7; }
.wf-quick-action:hover {
    background: rgba(255,153,0,0.15); border-color: var(--wf-accent);
    transform: translateY(-1px);
}
.wf-quick-action.qa-advanced {
    border-color: rgba(139,92,246,0.3); color: #a78bfa;
    background: rgba(139,92,246,0.06);
}
.wf-quick-action.qa-advanced:hover {
    background: rgba(139,92,246,0.15); border-color: #a78bfa;
}

/* Chat input */
.wf-chat-input-wrap {
    display: flex; gap: 6px; align-items: flex-end; padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; margin-top: auto;
}
.wf-chat-input {
    flex: 1; resize: none; border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04); color: var(--text-color);
    border-radius: 10px; padding: 8px 12px; font-size: 12px;
    max-height: 80px; min-height: 36px; line-height: 1.4;
    font-family: inherit;
}
.wf-chat-input:focus { border-color: var(--wf-accent); outline: none; box-shadow: 0 0 0 2px rgba(255,153,0,0.1); }
.wf-chat-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-chat-input::placeholder { color: var(--text-muted); }
.wf-chat-send-btn {
    width: 36px; height: 36px; border-radius: 10px; border: none;
    background: var(--wf-accent); color: #0a0e13; font-size: 14px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.15s; flex-shrink: 0;
}
.wf-chat-send-btn:hover { background: var(--wf-accent-light); transform: scale(1.05); }
.wf-chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Typing indicator */
.wf-typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.wf-typing-dots span {
    width: 6px; height: 6px; border-radius: 50%; background: var(--wf-accent); opacity: 0.4;
    animation: wfTypingBounce 1.2s infinite;
}
.wf-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.wf-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wfTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.wf-typing-cursor {
    display: inline-block; width: 2px; height: 14px; background: var(--wf-accent);
    margin-left: 2px; vertical-align: text-bottom;
    animation: wfCursorBlink 0.8s infinite;
}
@keyframes wfCursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
/* AI Blueprint — Apply to Canvas button */
.wf-bp-apply-wrap {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.wf-bp-apply-btn {
    display: flex; align-items: center; gap: 6px; width: 100%;
    padding: 8px 14px; border: 1px solid var(--wf-accent); border-radius: 8px;
    background: rgba(99,102,241,0.12); color: var(--wf-accent);
    font-size: .82rem; font-weight: 600; cursor: pointer;
    transition: all .2s;
}
.wf-bp-apply-btn:hover {
    background: rgba(99,102,241,0.25); transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.wf-bp-apply-btn.applied {
    background: rgba(16,185,129,0.15); border-color: #10b981; color: #10b981;
    cursor: default; pointer-events: none;
}
.wf-bp-apply-btn i { font-size: 1rem; }

#tabTemplates { padding-top: 0; }

/* ── Channel strip (Templates tab) ── */
.wf-channel-strip {
    display: flex; gap: 4px; padding: 10px 0 8px; flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.04); margin-bottom: 10px;
}
.wf-ch-pill {
    display: flex; align-items: center; gap: 4px;
    padding: 5px 8px; border-radius: 8px; font-size: 10px; font-weight: 600;
    border: 1px solid rgba(255,255,255,0.08); background: transparent;
    color: var(--text-muted); cursor: pointer; transition: all 0.2s;
    white-space: nowrap;
}
.wf-ch-pill:hover { border-color: rgba(255,255,255,0.18); color: var(--text-color); background: rgba(255,255,255,0.04); }
.wf-ch-pill.active { border-color: var(--wf-accent, #ff9900); color: var(--wf-accent, #ff9900); background: rgba(255,153,0,0.08); }
.wf-ch-pill i { font-size: 11px; }
.wf-ch-pill[data-channel="Email"].active { border-color: #38bdf8; color: #38bdf8; background: rgba(56,189,248,0.08); }
.wf-ch-pill[data-channel="SMS"].active { border-color: #34d399; color: #34d399; background: rgba(52,211,153,0.08); }
.wf-ch-pill[data-channel="WhatsApp"].active { border-color: #25d366; color: #25d366; background: rgba(37,211,102,0.08); }
.wf-ch-pill[data-channel="Phone"].active { border-color: #fbbf24; color: #fbbf24; background: rgba(251,191,36,0.08); }

/* ── Channel badges on template cards ── */
.wf-tpl-channels { display: flex; gap: 3px; margin-top: 2px; }
.wf-ch-badge {
    width: 18px; height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
    font-size: 9px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03);
}
.wf-ch-badge[data-ch="Email"] { color: #38bdf8; border-color: rgba(56,189,248,0.25); }
.wf-ch-badge[data-ch="SMS"] { color: #34d399; border-color: rgba(52,211,153,0.25); }
.wf-ch-badge[data-ch="WhatsApp"] { color: #25d366; border-color: rgba(37,211,102,0.25); }
.wf-ch-badge[data-ch="Phone"] { color: #fbbf24; border-color: rgba(251,191,36,0.25); }

/* ── Visual channel selector (Send node config) ── */
.wf-ch-selector {
    display: flex; gap: 4px;
}
.wf-ch-opt {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 4px; border-radius: 8px; cursor: pointer; transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.02);
}
.wf-ch-opt span { font-size: 9px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.wf-ch-opt i { font-size: 16px; color: var(--text-muted); transition: color 0.2s; }
.wf-ch-opt:hover { border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); }
.wf-ch-opt:hover i { color: var(--text-color); }
.wf-ch-opt.active { border-color: var(--wf-accent, #ff9900); background: rgba(255,153,0,0.06); }
.wf-ch-opt.active span { color: var(--text-color); }
.wf-ch-opt[data-ch="Email"].active { border-color: #38bdf8; background: rgba(56,189,248,0.08); }
.wf-ch-opt[data-ch="Email"].active i { color: #38bdf8; }
.wf-ch-opt[data-ch="SMS"].active { border-color: #34d399; background: rgba(52,211,153,0.08); }
.wf-ch-opt[data-ch="SMS"].active i { color: #34d399; }
.wf-ch-opt[data-ch="WhatsApp"].active { border-color: #25d366; background: rgba(37,211,102,0.08); }
.wf-ch-opt[data-ch="WhatsApp"].active i { color: #25d366; }
.wf-ch-opt[data-ch="Phone"].active { border-color: #fbbf24; background: rgba(251,191,36,0.08); }
.wf-ch-opt[data-ch="Phone"].active i { color: #fbbf24; }

/* ── Workflow Variables Panel ── */
.wf-vars-panel {
    border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 8px; padding-bottom: 4px;
}
.wf-vars-header {
    display: flex; align-items: center; gap: 6px; padding: 8px 4px; cursor: pointer;
    font-size: 12px; font-weight: 600; color: var(--text-color);
}
.wf-vars-header:hover { color: var(--accent); }
.wf-vars-header .bi-chevron-right { font-size: 10px; transition: transform 0.2s; }
.wf-vars-header .rot-90 { transform: rotate(90deg); }
.wf-vars-count {
    background: var(--accent); color: #000; font-size: 10px; font-weight: 700;
    padding: 0 5px; border-radius: 8px; min-width: 16px; text-align: center;
}
.wf-vars-list { padding: 4px 0; }
.wf-var-row {
    display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px;
    font-size: 11px; margin-bottom: 2px;
    background: rgba(255,255,255,0.02);
}
.wf-var-row:hover { background: rgba(255,255,255,0.05); }
.wf-var-name { font-family: 'Fira Code', monospace; color: var(--accent); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-var-type { color: var(--text-muted); font-size: 9px; text-transform: uppercase; background: rgba(255,255,255,0.04); padding: 1px 5px; border-radius: 3px; }
.wf-var-default { color: var(--text-muted); font-size: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-vars-add {
    display: flex; gap: 4px; margin-top: 6px; align-items: center;
}
.wf-vars-add input, .wf-vars-add select {
    font-size: 11px; padding: 3px 6px;
}

/* ── Switch Case / Parallel Branch rows ── */
.wf-switch-case input, .wf-parallel-branch input {
    font-size: 11px; padding: 3px 6px;
}

/* ── Templates Tab ── */
.wf-tpl-search {
    position: relative; margin-bottom: 12px; flex-shrink: 0;
}
.wf-tpl-search input {
    width: 100%; padding: 7px 10px 7px 32px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04);
    color: var(--text-color); font-size: 12px;
}
.wf-tpl-search input:focus { border-color: var(--wf-accent); outline: none; }
.wf-tpl-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-tpl-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; }
.wf-tpl-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.wf-tpl-section-hdr {
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted); padding: 8px 0 4px; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.wf-tpl-card {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 8px; cursor: pointer; transition: all 0.2s;
    border: 1px solid transparent;
}
.wf-tpl-card:hover {
    background: rgba(255,255,255,0.04); border-color: rgba(255,153,0,0.15);
    transform: translateX(3px);
}
.wf-tpl-card-icon {
    width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: #fff;
}
.wf-tpl-card-info { min-width: 0; flex: 1; }
.wf-tpl-card-info .tpl-name { font-size: 12px; font-weight: 600; color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-tpl-card-info .tpl-desc { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-tpl-card-info .tpl-nodes { font-size: 9px; color: var(--text-muted); margin-top: 1px; }

/* ── Nudge Config Tab ── */
#tabNudgeconfig { padding-top: 0; }
.wf-nc-subtabs {
    display: flex; gap: 0; border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.wf-nc-subtab {
    flex: 1; padding: 8px 0; text-align: center; font-size: 11px; font-weight: 600;
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent; transition: all 0.2s;
}
.wf-nc-subtab:hover { color: var(--text-color); }
.wf-nc-subtab.active { color: var(--wf-accent); border-bottom-color: var(--wf-accent); }
.wf-nc-panel { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.wf-nc-stats {
    display: flex; gap: 8px; padding: 6px 0; flex-shrink: 0; flex-wrap: wrap;
}
.wf-nc-stat {
    font-size: 10px; color: var(--text-muted); display: flex; align-items: center; gap: 3px;
}
.wf-nc-stat strong { color: var(--text-color); }
.wf-nc-stat.sent i { color: #34d399; }
.wf-nc-stat.pending i { color: #fbbf24; }
.wf-nc-list { flex: 1; overflow-y: auto; }
.wf-nc-group-hdr {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); padding: 8px 0 4px; display: flex; align-items: center; gap: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.wf-nc-count {
    font-size: 9px; background: rgba(255,255,255,0.06); padding: 0 5px; border-radius: 8px;
    color: var(--text-muted); font-weight: 600;
}
.wf-nc-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 6px;
    cursor: pointer; transition: background 0.15s;
}
.wf-nc-item:hover { background: rgba(255,255,255,0.04); }
.wf-nc-ch-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.wf-nc-ch-icon.ch-email { color: #38bdf8; }
.wf-nc-ch-icon.ch-sms { color: #34d399; }
.wf-nc-ch-icon.ch-whatsapp { color: #25d366; }
.wf-nc-ch-icon.ch-phone { color: #fbbf24; }
.wf-nc-item-info { flex: 1; min-width: 0; }
.wf-nc-item-subj {
    font-size: 11px; color: var(--text-color); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.wf-nc-item-meta { font-size: 9px; color: var(--text-muted); }
.wf-nc-status {
    font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.wf-nc-status.sent { color: #34d399; background: rgba(52,211,153,0.1); }
.wf-nc-status.delivered { color: #38bdf8; background: rgba(56,189,248,0.1); }
.wf-nc-status.pending { color: #fbbf24; background: rgba(251,191,36,0.1); }
.wf-nc-status.failed { color: #f87171; background: rgba(248,113,113,0.1); }
.wf-nc-active-badge {
    font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
    color: #34d399; background: rgba(52,211,153,0.1);
}
.wf-nc-inactive-badge {
    font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
    color: var(--text-muted); background: rgba(255,255,255,0.04);
}
.wf-nc-more {
    font-size: 10px; color: var(--text-muted); padding: 4px; text-align: center;
    font-style: italic;
}

/* ── Configure Tab — restore scroll + padding ── */
#tabConfigure { overflow-y: auto; }
#tabConfigure .wf-props-panel-form .form-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ══════════════════════════════════════════════════════════════════════
   WORLD-CLASS POLISH — Animations, Ergonomics, Advanced Features
   ══════════════════════════════════════════════════════════════════════ */

/* ── Node Entry Animation ── */
@keyframes wfNodeEntry {
    from { opacity: 0; transform: translateY(-12px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.wf-node.entering { animation: wfNodeEntry 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ── Node Error Shake ── */
@keyframes wfShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(5px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(3px); }
}
.wf-node.shake { animation: wfShake 0.4s ease; }

/* ── Execution Overlay Animations ── */
@keyframes execPulseGlow {
    0%,100% { box-shadow: 0 0 12px rgba(0,123,255,0.4), 0 0 24px rgba(0,123,255,0.15); border-color: rgba(0,123,255,0.7); }
    50%     { box-shadow: 0 0 20px rgba(0,123,255,0.7), 0 0 40px rgba(0,123,255,0.25); border-color: rgba(0,123,255,1); }
}
.wf-node.exec-running {
    animation: execPulseGlow 1.2s ease-in-out infinite;
    border: 2px solid rgba(0,123,255,0.8) !important;
    z-index: 10;
}
.wf-node.exec-running::after {
    content: '\f130'; /* bi-arrow-repeat */
    font-family: 'bootstrap-icons';
    position: absolute; top: -8px; right: -8px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #007bff; color: #fff; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
    animation: spin 1s linear infinite;
}
/* @keyframes spin — removed duplicate, see first declaration above */

.wf-node.exec-completed {
    border: 2px solid rgba(40,167,69,0.8) !important;
    box-shadow: 0 0 12px rgba(40,167,69,0.3);
}
.wf-node.exec-completed::after {
    content: '\f26e'; /* bi-check-lg */
    font-family: 'bootstrap-icons';
    position: absolute; top: -8px; right: -8px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #28a745; color: #fff; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
}

.wf-node.exec-failed {
    border: 2px solid rgba(220,53,69,0.8) !important;
    box-shadow: 0 0 12px rgba(220,53,69,0.3);
}
.wf-node.exec-failed::after {
    content: '\f623'; /* bi-x-lg */
    font-family: 'bootstrap-icons';
    position: absolute; top: -8px; right: -8px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #dc3545; color: #fff; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
}

/* ── Node Pulse (selected) ── */
@keyframes wfPulse {
    0%,100% { box-shadow: 0 0 24px rgba(255,153,0,0.25), 0 4px 16px rgba(0,0,0,0.3); }
    50%     { box-shadow: 0 0 32px rgba(255,153,0,0.4), 0 4px 16px rgba(0,0,0,0.3); }
}
.wf-node.selected { animation: wfPulse 2s ease-in-out infinite; }

/* ── Execution State Indicators ── */
@keyframes wfSpin { to { transform: rotate(360deg); } }
.wf-node.exec-running .wf-status-dot { background: #fbbf24; box-shadow: 0 0 10px #fbbf24; animation: wfPulse 0.8s ease-in-out infinite; }
.wf-node.exec-success .wf-status-dot { background: #34d399; box-shadow: 0 0 10px #34d399; }
.wf-node.exec-error .wf-status-dot   { background: #f87171; box-shadow: 0 0 10px #f87171; }
.wf-node.exec-waiting .wf-status-dot  { background: #6b7280; box-shadow: 0 0 6px #6b7280; }
.wf-node.exec-running::after {
    content: ''; position: absolute; top: 6px; right: 6px;
    width: 10px; height: 10px; border: 2px solid transparent;
    border-top-color: #fbbf24; border-radius: 50%; animation: wfSpin 0.7s linear infinite;
}

/* ── Node Tooltip ── */
.wf-node-tooltip {
    position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
    background: rgba(15,20,30,0.95); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 8px 12px; font-size: 10px; color: #ccc;
    white-space: nowrap; pointer-events: none; z-index: 20;
    opacity: 0; transition: opacity 0.15s;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.wf-node-tooltip::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: rgba(15,20,30,0.95);
}
.wf-node:hover .wf-node-tooltip { opacity: 1; }
.wf-node-tooltip .tt-row { display: flex; gap: 8px; align-items: center; }
.wf-node-tooltip .tt-label { color: rgba(255,255,255,0.4); }
.wf-node-tooltip .tt-val { color: var(--accent); font-weight: 600; }

/* ── Connection Hover ── */
.wf-canvas svg.wf-svg path.wf-conn { transition: stroke-width 0.15s, opacity 0.15s; cursor: pointer; }
.wf-canvas svg.wf-svg path.wf-conn:hover { stroke-width: 3.5; filter: drop-shadow(0 0 6px rgba(255,153,0,0.5)); }

/* ── Multi-select ── */
.wf-node.multi-selected {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 20px rgba(56,189,248,0.3), 0 4px 16px rgba(0,0,0,0.3) !important;
    animation: none !important;
}
.wf-selection-box {
    position: absolute; border: 1.5px dashed #38bdf8; background: rgba(56,189,248,0.06);
    pointer-events: none; z-index: 100; border-radius: 4px;
}

/* ── Connection Hover Highlights ── */
.wf-node.conn-highlight {
    border-color: rgba(255,153,0,0.5) !important;
    box-shadow: 0 0 18px rgba(255,153,0,0.2), 0 4px 16px rgba(0,0,0,0.3) !important;
    transition: border-color .15s, box-shadow .15s;
}
#wfSvg path.path-highlight {
    stroke-width: 3.5 !important;
    filter: drop-shadow(0 0 8px rgba(255,153,0,0.5)) !important;
    transition: stroke-width .15s, filter .15s;
}

/* ── Canvas Node Search Bar ── */
.wf-node-search-bar {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    z-index: 200; display: flex; align-items: center; gap: 6px;
    background: rgba(15,20,30,0.95); backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
    padding: 6px 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: wfSearchSlide 0.2s ease-out;
}
@keyframes wfSearchSlide { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.wf-node-search-bar i.bi-search { color: var(--text-muted); font-size: .85rem; }
.wf-node-search-bar input {
    background: transparent; border: none; outline: none; color: var(--text-color);
    font-size: .82rem; width: 200px; padding: 2px 4px;
}
.wf-node-search-bar input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-node-search-bar input::placeholder { color: rgba(255,255,255,0.3); }
.wf-node-search-bar span { font-size: .72rem; color: var(--text-muted); white-space: nowrap; min-width: 50px; text-align: center; }
.wf-node-search-bar button {
    background: transparent; border: none; color: var(--text-muted); cursor: pointer;
    padding: 2px 4px; border-radius: 4px; font-size: .8rem; line-height: 1;
}
.wf-node-search-bar button:hover { background: rgba(255,255,255,0.08); color: var(--text-color); }

/* ── Node Search Highlights ── */
.wf-node.search-match { border-color: rgba(251,191,36,0.5) !important; box-shadow: 0 0 12px rgba(251,191,36,0.2), 0 4px 16px rgba(0,0,0,0.3) !important; }
.wf-node.search-active { border-color: #fbbf24 !important; box-shadow: 0 0 24px rgba(251,191,36,0.4), 0 4px 16px rgba(0,0,0,0.3) !important; animation: wfSearchPulse 1.5s infinite; }
@keyframes wfSearchPulse { 0%,100% { box-shadow: 0 0 24px rgba(251,191,36,0.4); } 50% { box-shadow: 0 0 32px rgba(251,191,36,0.6); } }

/* ── Node Deletion Animation ── */
.wf-node.deleting {
    animation: wfNodeDelete 0.25s ease-in forwards;
    pointer-events: none;
}
@keyframes wfNodeDelete {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
    100% { opacity: 0; transform: scale(0.7) translateY(-10px); }
}

/* ── Canvas Pan Cursor ── */
.wf-canvas.panning { cursor: grab !important; }
.wf-canvas.panning:active { cursor: grabbing !important; }

/* ── Smooth Zoom (disabled during drag/pan via .no-transition class) ── */
.wf-canvas { transition: transform 0.18s cubic-bezier(0.25,0.46,0.45,0.94); }
.wf-canvas.no-transition { transition: none !important; }

/* ── Empty Canvas State ── */
.wf-canvas-empty {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    text-align: center; pointer-events: none; z-index: 1;
    animation: emptyFadeIn 0.6s ease forwards;
}
@keyframes emptyFadeIn {
    from { opacity: 0; transform: translate(-50%,-50%) scale(0.9); }
    to { opacity: 0.5; transform: translate(-50%,-50%) scale(1); }
}
.wf-canvas-empty i {
    font-size: 64px; color: rgba(255,153,0,0.2); display: block; margin-bottom: 12px;
    animation: emptyIconPulse 3s ease-in-out infinite;
}
@keyframes emptyIconPulse {
    0%,100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(1.05); }
}
.wf-canvas-empty .ce-title { font-size: 16px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.wf-canvas-empty .ce-sub { font-size: 11px; color: rgba(255,255,255,0.3); line-height: 1.6; }
.wf-canvas-empty kbd {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    padding: 1px 5px; border-radius: 3px; font-size: 10px; font-family: inherit;
}

/* ── Sticky Notes ── */
.wf-sticky {
    position: absolute; width: 160px; min-height: 60px; padding: 8px 10px;
    border-radius: 4px; font-size: 11px; line-height: 1.4;
    cursor: move; z-index: 1; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: none; resize: both; overflow: auto;
    font-family: 'Inter', sans-serif;
}
.wf-sticky-yellow { background: rgba(251,191,36,0.18); color: #fbbf24; }
.wf-sticky-blue   { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.wf-sticky-green  { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.wf-sticky-pink   { background: rgba(244,114,182,0.15); color: #f9a8d4; }
.wf-sticky textarea {
    width: 100%; border: none; background: transparent; color: inherit;
    font-size: 11px; font-family: inherit; resize: none; outline: none;
    min-height: 40px; line-height: 1.4;
}
.wf-sticky textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-sticky-del {
    position: absolute; top: 2px; right: 4px; font-size: 12px;
    cursor: pointer; opacity: 0; transition: opacity 0.15s; color: inherit;
    background: none; border: none; padding: 0; line-height: 1;
}
.wf-sticky:hover .wf-sticky-del { opacity: 0.7; }
.tpl-preview-btn {
    opacity: 0; cursor: pointer; font-size: 11px; color: var(--accent);
    transition: opacity 0.15s; margin-left: 4px;
}
.wf-tpl-card:hover .tpl-preview-btn { opacity: 0.8; }
.tpl-preview-btn:hover { opacity: 1 !important; }

/* ── Template Preview Modal ── */
.wf-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); animation: wfFadeIn 0.2s ease forwards;
}
@keyframes wfFadeIn { from { opacity: 0; } to { opacity: 1; } }
.wf-modal {
    background: var(--bg-secondary); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px; width: 560px; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
    animation: wfModalIn 0.2s ease forwards;
}
@keyframes wfModalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wf-modal-header {
    display: flex; align-items: center; gap: 12px; padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wf-modal-header .modal-icon {
    width: 44px; height: 44px; border-radius: 12px; display: flex;
    align-items: center; justify-content: center; font-size: 20px;
}
.wf-modal-header .modal-title { font-size: 16px; font-weight: 700; color: var(--text-color); }
.wf-modal-header .modal-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.wf-modal-close {
    margin-left: auto; background: none; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; padding: 4px;
}
.wf-modal-close:hover { color: #fff; }
.wf-modal-body { padding: 20px 24px; }
.wf-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.06);
}
.wf-modal-node-list { display: flex; flex-direction: column; gap: 6px; }
.wf-modal-node {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: rgba(255,255,255,0.02); border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.04);
}
.wf-modal-node .mn-icon {
    width: 28px; height: 28px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0;
}
.wf-modal-node .mn-name { font-size: 12px; font-weight: 600; color: var(--text-color); }
.wf-modal-node .mn-type { font-size: 9px; color: var(--text-muted); text-transform: uppercase; }
.wf-modal-node .mn-arrow { color: rgba(255,255,255,0.15); margin-left: auto; font-size: 12px; }

/* ── Keyboard Shortcuts Modal ── */
.wf-shortcuts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.wf-shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.wf-shortcut-row .sc-label { font-size: 12px; color: var(--text-muted); }
.wf-shortcut-row .sc-keys { display: flex; gap: 3px; }
.wf-shortcut-row kbd {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    padding: 2px 7px; border-radius: 4px; font-size: 11px; color: var(--text-color);
    font-family: 'Inter', sans-serif; min-width: 20px; text-align: center;
}

/* ── Export/Import Buttons ── */
.wf-toolbar-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.08); margin: 0 4px; }

/* ── Branch Analytics Badges ── */
.wf-branch-count {
    font-size: 8px; font-weight: 700; fill: rgba(255,255,255,0.5);
    text-anchor: middle; dominant-baseline: central; pointer-events: none;
}

/* ── Execution Simulation Overlay ── */
@keyframes wfExecPulse {
    0% { r: 4; opacity: 1; }
    100% { r: 12; opacity: 0; }
}
.wf-exec-dot {
    fill: #fbbf24; filter: drop-shadow(0 0 4px #fbbf24);
}
.wf-exec-dot-pulse { fill: #fbbf24; animation: wfExecPulse 0.8s ease-out forwards; }

/* ── Notification badge on tab ── */
.wf-tab-badge {
    position: absolute; top: 4px; right: 8px;
    background: #f87171; color: #fff; font-size: 8px; font-weight: 700;
    width: 14px; height: 14px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; line-height: 1;
}

/* ── Enhanced Context Menu ── */
.wf-ctx-menu .ctx-section { font-size: 9px; text-transform: uppercase; color: var(--text-muted); padding: 6px 12px 2px; letter-spacing: 0.5px; font-weight: 600; }

/* ── Node count badge on canvas ── */
.wf-node-badge {
    position: absolute; top: -6px; left: -6px;
    background: var(--accent); color: #000; font-size: 8px; font-weight: 700;
    width: 18px; height: 18px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; z-index: 3;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ── Validation Results Panel ── */
.wf-validation-panel {
    padding: 12px; margin-top: 8px;
}
.wf-val-header {
    display: flex; align-items: center; padding: 8px 10px;
    background: rgba(255,193,7,0.08); border: 1px solid rgba(255,193,7,0.15);
    border-radius: 8px; margin-bottom: 10px; font-size: 12px;
}
.wf-val-item {
    display: flex; align-items: flex-start; padding: 8px 10px;
    border-radius: 6px; margin-bottom: 4px; font-size: 11px;
    border: 1px solid transparent; transition: all 0.15s;
}
.wf-val-item:hover { background: rgba(255,255,255,0.03); }
.wf-val-item.val-error { border-left: 3px solid #f87171; }
.wf-val-item.val-warning { border-left: 3px solid #fbbf24; }
.wf-val-item i.bi { flex-shrink: 0; margin-top: 2px; }
.wf-node.invalid { border-color: #f87171 !important; box-shadow: 0 0 12px rgba(248,113,113,0.3) !important; }
.wf-node.shake { animation: wfShake 0.4s ease; }
.val-goto {
    cursor: pointer; font-size: 11px; color: var(--accent); opacity: 0.5;
    transition: opacity 0.15s;
}
.val-goto:hover { opacity: 1; }
.val-fix-hint {
    font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 2px;
}
.val-fix-hint .bi-lightbulb { color: rgba(255,193,7,0.5); }
.val-autofix {
    display: inline-block; cursor: pointer; color: #34d399; font-weight: 600;
    margin-left: 4px; padding: 0 4px; border-radius: 3px;
    background: rgba(52,211,153,0.08); transition: all 0.15s;
}
.val-autofix:hover { background: rgba(52,211,153,0.18); color: #6ee7b7; }

/* ── Workflow Log & Audit Drawer ── */
.wf-log-drawer {
    display: none; flex-direction: column;
    background: rgba(10,14,24,0.97); backdrop-filter: blur(16px);
    border-top: 1px solid rgba(99,102,241,0.2);
    max-height: 280px; min-height: 160px;
    overflow: hidden; animation: wfLogSlideUp 0.25s ease-out;
}
@keyframes wfLogSlideUp { from { max-height: 0; opacity: 0; } to { max-height: 280px; opacity: 1; } }

.wf-log-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(99,102,241,0.04); flex-shrink: 0;
}
.wf-log-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px; padding: 0 6px; font-size: 10px; font-weight: 700;
    background: rgba(99,102,241,0.15); color: var(--wf-accent, #6366f1);
    border-radius: 9px;
}
.wf-log-filters {
    display: flex; gap: 2px; background: rgba(255,255,255,0.04);
    border-radius: 6px; padding: 2px;
}
.wf-log-filter {
    background: none; border: none; color: rgba(255,255,255,0.45);
    font-size: 11px; padding: 3px 10px; border-radius: 4px; cursor: pointer;
    transition: all 0.15s;
}
.wf-log-filter:hover { color: rgba(255,255,255,0.7); }
.wf-log-filter.active { background: rgba(99,102,241,0.2); color: #a5b4fc; font-weight: 600; }
.wf-log-refresh, .wf-log-close {
    background: none; border: none; color: rgba(255,255,255,0.35);
    font-size: 13px; padding: 4px 6px; cursor: pointer; border-radius: 4px;
    transition: all 0.15s;
}
.wf-log-refresh:hover, .wf-log-close:hover { color: #fff; background: rgba(255,255,255,0.06); }

.wf-log-body {
    flex: 1; overflow-y: auto; padding: 0;
}
.wf-log-table {
    width: 100%; border-collapse: collapse; font-size: 11px;
}
.wf-log-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: rgba(15,20,35,0.95); padding: 6px 10px;
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    color: rgba(255,255,255,0.35); border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}
.wf-log-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.12s;
}
.wf-log-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.wf-log-table tbody td {
    padding: 7px 10px; white-space: nowrap; color: rgba(255,255,255,0.7);
}
.wf-log-table .log-icon-ok { color: #34d399; font-size: 13px; }
.wf-log-table .log-icon-warn { color: #fbbf24; font-size: 13px; }
.wf-log-table .log-icon-audit { color: #818cf8; font-size: 13px; }
.wf-log-table .log-row-warn td:first-child { border-left: 3px solid #fbbf24; }
.wf-log-table .log-row-audit td:first-child { border-left: 3px solid #818cf8; }

/* ========== Insurance Deductions Config — Pipeline Builder ========== */

.pipeline-container { background: var(--bg-glass); border: 1px solid var(--border-color); border-radius: 12px; padding: 24px; margin-bottom: 16px; }
.pipeline-track { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 20px 0; }
.pipeline-stage { position: relative; min-width: 140px; background: var(--bg-tertiary); border: 2px solid var(--border-color); border-radius: 10px; padding: 14px 16px; text-align: center; cursor: pointer; transition: all .2s; flex-shrink: 0; }
.pipeline-stage:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.pipeline-stage.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,188,212,.2); }
.pipeline-stage .stage-color-strip { position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 8px 8px 0 0; }
.pipeline-stage .stage-icon { font-size: 20px; margin-bottom: 4px; }
.pipeline-stage .stage-label { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.pipeline-stage .stage-sla { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.pipeline-stage .stage-team { font-size: 9px; color: var(--text-muted); margin-top: 1px; opacity: .7; }
.pipeline-stage.terminal { border-style: dashed; opacity: .85; }
.pipeline-stage.terminal:hover { opacity: 1; }

.pipeline-arrow { display: flex; align-items: center; padding: 0 6px; flex-shrink: 0; }
.pipeline-arrow::after { content: ''; display: block; width: 28px; height: 2px; background: var(--border-color); position: relative; }
.pipeline-arrow::before { content: ''; display: block; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid var(--border-color); position: absolute; right: 0; }
.pipeline-arrow { position: relative; width: 42px; }

/* Transition matrix */
.transition-matrix { width: 100%; border-collapse: collapse; font-size: 11px; }
.transition-matrix th { background: rgba(255,255,255,.03); color: var(--text-secondary); font-weight: 600; padding: 6px 8px; border: 1px solid var(--border-color); text-align: center; }
.transition-matrix th.rotate { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; height: 80px; width: 36px; }
.transition-matrix td { padding: 6px 8px; border: 1px solid rgba(255,255,255,.04); text-align: center; }
.transition-matrix td.self { background: rgba(255,255,255,.02); }
.transition-matrix input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Reorder arrows */
.reorder-arrows { display: flex; flex-direction: column; gap: 2px; }
.reorder-arrows .btn { padding: 1px 5px; font-size: 10px; line-height: 1; }

/* SLA bar preview */
.sla-bar { height: 8px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.sla-bar .sla-fill { height: 100%; border-radius: 4px; transition: width .3s; }

/* Threshold card */
.threshold-card { background: var(--bg-glass); border: 1px solid var(--border-color); border-radius: 10px; padding: 16px; }
.threshold-card .threshold-value { font-size: 24px; font-weight: 700; }
.threshold-card .threshold-bar { height: 6px; border-radius: 3px; background: var(--bg-tertiary); margin-top: 8px; overflow: hidden; }
.threshold-card .threshold-fill { height: 100%; border-radius: 3px; transition: width .3s; }

/* Rule builder */
.rule-condition { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; }
.rule-condition select, .rule-condition input { max-width: 180px; }

/* Quick settings offcanvas */
.quick-settings .toggle-row { padding: 12px 0; }
.quick-settings .form-select-sm { font-size: 12px; background: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-primary); }

/* ==========================================================================
   Error Page
   ========================================================================== */
.error-code {
    font-size: 96px;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

/* ==========================================================================
   Audit Trail — Severity & Category Badges
   ========================================================================== */
.badge-severity-info     { background: rgba(56,189,248,0.15); color: #38bdf8; border: 1px solid rgba(56,189,248,0.25); }
.badge-severity-warning  { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.badge-severity-error    { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.25); }
.badge-severity-critical { background: rgba(248,113,113,0.25); color: #fca5a5; border: 1px solid rgba(248,113,113,0.4); animation: pulse-red 1.5s infinite; }
@keyframes pulse-red { 0%,100% { opacity:1; } 50% { opacity:0.7; } }

.badge-cat-clinical    { background: rgba(45,212,191,0.15); color: #2dd4bf; }
.badge-cat-engagement  { background: rgba(129,140,248,0.15); color: #818cf8; }
.badge-cat-operational { background: rgba(56,189,248,0.15); color: #38bdf8; }
.badge-cat-admin       { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-cat-financial   { background: rgba(52,211,153,0.15); color: #34d399; }
.badge-cat-compliance  { background: rgba(251,191,36,0.15); color: #fbbf24; }
.badge-cat-general     { background: rgba(148,163,184,0.10); color: #64748b; }

/* ==========================================================================
   Scheduler — Gantt Timeline
   ========================================================================== */
.node-gantt { position: relative; background: rgba(255,255,255,0.03); border-radius: 8px; padding: 8px 0; margin: 12px 0; }
.gantt-bar {
    height: 24px; border-radius: 4px; margin: 4px 12px;
    display: flex; align-items: center; padding: 0 8px;
    font-size: 11px; color: white; min-width: 60px;
    transition: all 0.3s;
}
.gantt-bar:hover { filter: brightness(1.2); transform: scaleY(1.15); }
.gantt-bar.completed   { background: var(--accent-3); }
.gantt-bar.failed      { background: var(--accent-red); }
.gantt-bar.running     { background: var(--accent); animation: pulse-glow 1.5s infinite; }
.gantt-bar.partial     { background: var(--accent-amber); }
.gantt-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-timeline { display: flex; gap: 3px; align-items: center; }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mini-dot.completed   { background: var(--accent-3); }
.mini-dot.failed      { background: var(--accent-red); }
.mini-dot.running     { background: var(--accent); }
.mini-dot.partial     { background: var(--accent-amber); }
@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 4px rgba(56,189,248,0.4); } 50% { box-shadow: 0 0 12px rgba(56,189,248,0.8); } }

/* Correlation ID link */
.cid-link { cursor: pointer; color: var(--accent); text-decoration: none; font-family: monospace; font-size: 11px; }
.cid-link:hover { text-decoration: underline; }

/* ==========================================================================
   Empty State Component
   ========================================================================== */

.empty-state { text-align:center; padding:48px 24px; color:var(--text-muted); }
.empty-state i { font-size:48px; opacity:0.3; display:block; margin-bottom:16px; }
.empty-state .empty-title { font-size:16px; font-weight:600; color:var(--text-secondary); margin-bottom:8px; }
.empty-state .empty-desc { font-size:13px; max-width:320px; margin:0 auto; }

/* ==========================================================================
   Skeleton Loader
   ========================================================================== */

.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; border-radius: 6px; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text.short { width: 40%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: 12px; }
.skeleton-row { height: 48px; margin-bottom: 4px; border-radius: 8px; }

/* ==========================================================================
   Confirmation Dialog
   ========================================================================== */

.confirm-dialog .modal-content { background: var(--bg-card); border: 1px solid rgba(248,113,113,0.3); }
.confirm-dialog .btn-danger-glass { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); transition: var(--transition); }
.confirm-dialog .btn-danger-glass:hover { background: rgba(248,113,113,0.3); border-color: rgba(248,113,113,0.5); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(248,113,113,0.2); }

/* ==========================================================================
   Global Search Modal
   ========================================================================== */

.search-result-item:hover { background: rgba(255,255,255,0.05) !important; }
.search-result-item:focus { background: rgba(56,189,248,0.1) !important; outline: none; }
.search-result-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Notification Panel — Mobile Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .notification-panel { width: 85vw; max-width: 100%; }
    .journey-fab-popup { width: calc(100vw - 32px); right: 16px; }
}

/* ==========================================================================
   Wave G — Global AJAX Loading Bar
   ========================================================================== */

.ajax-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
    background-size: 200% 100%;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ajax-loading-bar.active {
    opacity: 1;
    animation: ajax-bar-progress 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite,
               ajax-bar-shimmer 1.2s ease infinite;
}

.ajax-loading-bar.finishing {
    width: 100% !important;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.4s ease 0.2s;
}

@keyframes ajax-bar-progress {
    0%   { width: 0; }
    20%  { width: 30%; }
    50%  { width: 60%; }
    80%  { width: 85%; }
    100% { width: 92%; }
}

@keyframes ajax-bar-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   Wave G — Empty State Block (renderEmptyState)
   ========================================================================== */

.empty-state-block {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-block i {
    font-size: 56px;
    opacity: 0.25;
    display: block;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.empty-state-block .empty-state-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-block .empty-state-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ==========================================================================
   Wave G — Column Sorting Indicators
   ========================================================================== */

.col-sortable:hover {
    color: var(--accent) !important;
}

.col-sortable .sort-indicator {
    font-weight: 400;
    color: var(--accent);
}

/* ==========================================================================
   Accessibility: Respect reduced motion preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Print Media: Clean, printer-friendly output
   ========================================================================== */

@media print {
    body { background: #fff !important; color: #000 !important; font-size: 12pt; }
    .sidebar, .topbar, .journey-fab, .journey-fab-popup,
    .btn, .modal, .toast-container, .nav-tabs,
    .ajax-loading-bar, #confirmActionModal { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .glass-card { background: #fff !important; border: 1px solid #ccc !important;
                  box-shadow: none !important; backdrop-filter: none !important;
                  color: #000 !important; break-inside: avoid; margin-bottom: 12pt; }
    .glass-table { border-collapse: collapse; width: 100%; }
    .glass-table th, .glass-table td { border: 1px solid #999 !important; padding: 4pt 8pt;
                                        color: #000 !important; background: #fff !important; }
    .glass-table thead th { background: #eee !important; font-weight: 700; }
    .stat-card { border: 1px solid #ccc !important; }
    .stat-value { color: #000 !important; }
    .stat-label { color: #555 !important; }
    .badge, .badge-status { border: 1px solid #999; color: #000 !important;
                            background: #eee !important; }
    .chart-container, canvas { max-height: 200pt !important; break-inside: avoid; }
    a { color: #000 !important; text-decoration: underline; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
    a.nav-link::after, a[onclick]::after { content: none; }
    h1, h2, h3, h4, h5, h6 { color: #000 !important; break-after: avoid; }
    .text-muted, .text-muted-custom { color: #555 !important; }
}

/* ==========================================================================
   Phase 2-5: Accessibility + Dashboard Builder
   ========================================================================== */

/* Skip Navigation */
.skip-nav {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: #000;
    padding: 8px 16px;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-nav:focus {
    top: 0;
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px;
}
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px;
}

/* High Contrast Mode */
body.high-contrast {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --bg-glass: #1a1a1a;
    --border-color: #ffffff;
    --border-glow: #ffffff;
    --accent: #00ffff;
    --accent-2: #ff00ff;
    --accent-3: #00ff00;
    --accent-red: #ff4444;
    --accent-amber: #ffff00;
    --text-primary: #ffffff;
    --text-secondary: #eeeeee;
    --text-muted: #cccccc;
}
body.high-contrast .glass-card {
    border: 2px solid #fff !important;
}
body.high-contrast .sidebar {
    border-right: 2px solid #fff;
}
body.high-contrast .btn-accent {
    border: 2px solid var(--accent);
}

/* Inbox split layout */
.inbox-layout {
    display: flex;
    height: calc(100vh - var(--topbar-height) - 80px);
    gap: 1px;
}
.inbox-list {
    width: 380px;
    min-width: 320px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}
.inbox-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.inbox-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.inbox-reply {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}
.inbox-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
}
.inbox-item:hover, .inbox-item.active {
    background: rgba(56,189,248,0.06);
}
.inbox-item.unread {
    border-left: 3px solid var(--accent);
}
.msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}
.msg-inbound {
    background: var(--bg-card);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.msg-outbound {
    background: rgba(56,189,248,0.15);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Dashboard Builder Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    min-height: 400px;
}
.dashboard-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    position: relative;
    overflow: hidden;
}
.dashboard-widget .widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dashboard-widget .widget-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.dashboard-widget:hover .widget-actions {
    opacity: 1;
}

/* Clinical NLP entity highlights */
.entity-symptom { background: rgba(251,191,36,0.2); border-bottom: 2px solid #fbbf24; padding: 0 2px; }
.entity-medication { background: rgba(56,189,248,0.2); border-bottom: 2px solid #38bdf8; padding: 0 2px; }
.entity-diagnosis { background: rgba(248,113,113,0.2); border-bottom: 2px solid #f87171; padding: 0 2px; }
.entity-procedure { background: rgba(52,211,153,0.2); border-bottom: 2px solid #34d399; padding: 0 2px; }
.entity-lab_value { background: rgba(129,140,248,0.2); border-bottom: 2px solid #818cf8; padding: 0 2px; }
