/* ================================================================
   PEDRO2 Web — Premium Dark Mode Design
   GAMP5 Cat.4 | NIS2 Compliant
   ================================================================ */

/* ── CSS Variables ─────────────────────────────────── */
:root {
    /* Deep navy palette */
    --bg-primary: #0a0f1e;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-card-hover: #1e2740;
    --bg-input: #0f172a;
    --bg-navbar: rgba(10, 15, 30, 0.92);

    /* Accent blue */
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-dark: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.15);

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;

    /* Status colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    /* Borders */
    --border: #1e293b;
    --border-light: #334155;

    /* Glassmorphism */
    --glass-bg: rgba(26, 34, 54, 0.75);
    --glass-blur: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

/* Spacing */
    --nav-height: 60px;

    /* Success & Danger hover colors */
    --success-dark: #059669;
    --danger-dark: #dc2626;

    /* BPM variables aliases */
    --color-danger: var(--danger);
    --color-danger-muted: var(--danger-bg);
    --color-warning: var(--warning);
    --color-warning-muted: var(--warning-bg);
    --color-success: var(--success);
    --color-text-muted: var(--text-muted);
    --color-border: var(--border);
    --color-bg-code: #0d1117;
    --color-text-code: #e6edf3;
}

/* ── Light Theme Variables ─────────────────────────── */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --bg-navbar: rgba(255, 255, 255, 0.95);

    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-dark: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.1);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-heading: #020617;

    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.1);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.1);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.1);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.1);

    --border: #e2e8f0;
    --border-light: #cbd5e1;

    --glass-bg: rgba(255, 255, 255, 0.85);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(37, 99, 235, 0.2);
}

/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-navbar);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: var(--transition-slow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.nav-brand i {
    font-size: 22px;
    color: var(--accent-light);
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.5px;
}

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

.brand-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--accent-glow);
    color: var(--accent-light);
    border-radius: 4px;
    font-weight: 500;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}

.nav-link.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.role-badge {
    font-size: 9px;
    padding: 1px 6px;
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.logout-link {
    color: var(--text-muted) !important;
}

.logout-link:hover {
    color: var(--danger) !important;
    background: var(--danger-bg) !important;
}

/* ── Main Content ──────────────────────────────────── */
.main-content {
    padding: calc(var(--nav-height) + 24px) 24px 80px;
    max-width: 1600px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

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

/* ── Page Header ───────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header-right {
    display: flex;
    gap: 8px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--accent);
}

.record-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent-dark);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--accent-light);
    box-shadow: var(--shadow-glow);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-warning {
    background: var(--warning);
    color: #111;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
}

/* ── Forms ─────────────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.form-input, .form-select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input:disabled, .form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-input-sm {
    width: auto;
    min-width: 160px;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* ── Form Grid ─────────────────────────────────────── */
.form-grid {
    display: grid;
    gap: 8px;
}

.form-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 28px 200px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}


.form-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-checkbox-col {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Checkbox (custom & global) ────────────────────── */
.form-checkbox-label {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-checkbox-label input[type="checkbox"]:has(~ .checkmark) {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 16px;
    width: 16px;
    background-color: var(--bg-input, #f1f5f9);
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.form-checkbox-label:hover input ~ .checkmark {
    border-color: var(--accent, #3b82f6);
}

.form-checkbox-label input:checked ~ .checkmark {
    background-color: var(--accent, #3b82f6);
    border-color: var(--accent, #3b82f6);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.form-checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

.form-checkbox-label .checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ── Global Form Control Styles ────────────────────── */
input[type="checkbox"]:not(:has(~ .checkmark)) {
    appearance: none;
    -webkit-appearance: none;
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: 4px;
    background-color: var(--bg-input, #f1f5f9);
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

input[type="checkbox"]:not(:has(~ .checkmark)):hover {
    border-color: var(--accent, #3b82f6);
}

input[type="checkbox"]:not(:has(~ .checkmark)):checked {
    background-color: var(--accent, #3b82f6);
    border-color: var(--accent, #3b82f6);
}

input[type="checkbox"]:not(:has(~ .checkmark)):checked::after {
    content: '';
    position: absolute;
    left: 4.5px;
    top: 1.5px;
    width: 4.5px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="radio"]:not(.radio-label input) {
    appearance: none;
    -webkit-appearance: none;
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: 50%;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--bg-input, #fff);
    position: relative;
    vertical-align: middle;
}

input[type="radio"]:not(.radio-label input):hover {
    border-color: var(--accent, #3b82f6);
}

input[type="radio"]:not(.radio-label input):checked {
    border-color: var(--accent, #3b82f6);
    background: var(--accent, #3b82f6);
}

input[type="radio"]:not(.radio-label input):checked::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.panel-body {
    padding: 16px 18px;
}
.bpm-case-panel .panel-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Panels ────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(59, 130, 246, 0.05);
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 i {
    color: var(--accent-light);
    font-size: 14px;
}

.panel-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.detail-panel .form-grid,
.detail-panel .create-form {
    padding: 16px 18px;
}

/* ── Table ─────────────────────────────────────────── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

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

.data-table thead th {
    position: sticky;
    top: 0;
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.table-row-clickable {
    cursor: pointer;
}

.table-row-clickable:hover {
    background: var(--accent-glow) !important;
}

.cell-mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
    font-size: 12px;
    color: var(--accent-light);
    font-weight: 500;
}

.cell-nowrap {
    white-space: nowrap;
}

.cell-old {
    color: var(--danger);
    font-size: 12px;
}

.cell-new {
    color: var(--success);
    font-size: 12px;
}

.col-action {
    width: 60px;
    text-align: center;
}

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

.empty-state i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-info {
    background: var(--info-bg);
    color: var(--accent-light);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-status {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-action {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 10px;
    padding: 2px 8px;
    letter-spacing: 0.3px;
}

/* ── Filter Bar ────────────────────────────────────── */
.filter-bar {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-search {
    min-width: 300px;
}

.filter-group .form-select,
.filter-group .form-input {
    min-width: 160px;
}

/* ── Products ──────────────────────────────────────── */
.products-table-wrapper {
    max-height: 340px;
    overflow-y: auto;
}

.product-row {
    cursor: pointer;
    transition: var(--transition);
}

.product-row.selected {
    background: var(--accent-glow) !important;
    border-left: 3px solid var(--accent);
}

.product-row:hover {
    background: var(--bg-card-hover);
}

.products-table {
    font-size: 12px;
}

.add-product-row {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.product-detail-panel {
    margin-bottom: 20px;
}

.scope-toggle {
    display: flex;
    gap: 16px;
}

.radio-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: 50%;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--bg-input, #fff);
    position: relative;
}

.radio-label input[type="radio"]:checked {
    border-color: var(--accent, #3b82f6);
    background: var(--accent, #3b82f6);
}

.radio-label input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ── Product Selector (Create page) ────────────────── */
.product-selector {
    padding: 16px;
}

.family-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.product-checkboxes {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.product-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.product-checkbox-label:hover {
    background: var(--accent-glow);
}

.product-checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
}

.product-family-badge {
    font-size: 10px;
    background: var(--bg-card);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 700;
    border: 1px solid var(--border);
}

.product-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.selection-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Column Checkboxes ─────────────────────────────── */
.column-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
}

/* ── Action Bar ────────────────────────────────────── */
.action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
}

/* ── Flash Messages ────────────────────────────────── */
.flash-container {
    margin-bottom: 16px;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    animation: slideIn 0.3s ease;
    margin-bottom: 6px;
    border: 1px solid transparent;
}

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

.flash-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.flash-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.flash-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.flash-info {
    background: var(--info-bg);
    color: var(--accent-light);
    border-color: rgba(59, 130, 246, 0.2);
}

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
}

/* ── Auth ──────────────────────────────────────────── */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

.auth-card {
    width: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 12px;
    text-shadow: 0 0 40px var(--accent-glow);
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-heading);
}

.auth-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.compliance-badge {
    color: var(--text-muted);
    font-size: 11px;
}

.compliance-badge i {
    color: var(--success);
}

/* ── Dictionaries Grid ─────────────────────────────── */
.dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dict-panel {
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.dict-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 12px;
}

.dict-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.dict-item:last-child {
    border-bottom: none;
}

.dict-item:hover {
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
}

/* ── Pagination ────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 16px 0;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 8px;
}

/* ── Audit Footer ──────────────────────────────────── */
.audit-footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

.audit-footer i {
    color: var(--success);
}

/* ── Report Config ─────────────────────────────────── */
.report-config-container .detail-panel {
    padding-bottom: 16px;
}

.report-config-container .form-grid {
    padding: 16px;
}

.report-config-container h3 {
    padding: 0 16px;
    color: var(--text-heading);
    font-size: 14px;
}

.report-config-container .column-checkboxes {
    padding: 0 16px;
}

.report-config-container .action-bar {
    padding: 0 16px 16px;
}

/* ── Footer ────────────────────────────────────────── */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 24px;
    background: var(--bg-navbar);
    backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--border);
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

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

/* ── Create User Form ──────────────────────────────── */
.create-user-form {
    padding: 16px;
}

.form-group-actions {
    display: flex;
    align-items: flex-end;
}

.action-btns {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ── Case Title ────────────────────────────────────── */
.case-title {
    font-family: 'SF Mono', Consolas, monospace;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 16px;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 2px;
    }

    .main-content {
        padding: 80px 12px 100px;
    }

    .filter-search {
        min-width: 200px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 28px 100px 1fr;
    }
}
/* ── Document Management ───────────────────────────── */
.documents-table-wrapper {
    overflow-x: auto;
}

.inline-form-grid {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.inline-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inline-field label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.select-sm, .input-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.cell-remarks {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-remarks:hover {
    white-space: normal;
    overflow: visible;
}

.flex-grow {
    flex-grow: 1;
}



/* ── Product Master Database UI ────────────────────── */
.family-tab-pill {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.family-tab-pill:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--accent);
}

.family-tab-pill.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-cat-no {
    font-size: 10px;
    color: var(--text-muted);
}

.master-search-results {
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.master-result-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.master-result-item:hover {
    background: var(--accent-glow);
}

.result-text {
    display: flex;
    flex-direction: column;
}

.res-name {
    font-size: 12px;
    font-weight: 500;
}

.res-cat {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Searchable Select (Combobox) ─────────────────── */
.searchable-select {
    position: relative;
    width: 100%;
}

.ss-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.ss-input-wrapper i {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.searchable-select.active .ss-input-wrapper i {
    transform: rotate(180deg);
}

.ss-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    animation: ssSlideDown 0.2s ease;
}

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

.searchable-select.active .ss-dropdown {
    display: block;
}

.ss-option {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.ss-option:last-child {
    border-bottom: none;
}

.ss-option:hover {
    background: var(--accent-glow);
    color: var(--accent-light);
}

.ss-option.selected {
    background: var(--accent-glow);
    color: var(--accent-light);
    font-weight: 600;
}

.ss-no-results {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.master-link {
    color: var(--accent);
    margin-left: 8px;
    font-size: 0.85em;
    opacity: 0.7;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.master-link:hover {
    opacity: 1;
    transform: scale(1.2);
    color: var(--accent-light);
}

/* ── Unified Search Styles ─────────────────────── */
.search-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.search-with-icon i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}
.search-with-icon .form-input {
    padding-left: 35px;
}

.search-divider {
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin: 8px 0;
}

.extra-result {
    border-left: 3px solid var(--accent);
}

.prodocs-table th, .prodocs-table td {
    font-size: 12px;
    padding: 8px 6px;
    white-space: nowrap;
}
.prodocs-form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.btn-xxs {
    padding: 2px 5px;
    font-size: 10px;
}
.cell-bold {
    font-weight: 700;
}

/* ── Pagination ────────────────────────────────────── */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: 5px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-current {
    font-size: 13px;
    font-weight: 600;
    padding: 0 8px;
    color: var(--text-primary);
}

/* ── Modals ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 95%;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i {
    color: var(--accent);
}

/* ── Imported/Special Grids ────────────────────────── */
.filter-grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.export-cols-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .export-cols-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Detail Info Refinement ────────────────────────── */
.detail-content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 0;
}

.detail-info-item {
    border-right: 1px solid var(--border);
    padding: 12px 20px;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.detail-info-item:nth-child(2n) {
    border-right: none;
}

.detail-info-label {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.82em;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
    letter-spacing: 0.2px;
}

.detail-info-label.muted {
    color: var(--text-muted);
}

.detail-info-value {
    font-size: 1.02em;
    color: var(--text-primary);
}

.flex-row {
    display: flex;
    gap: 24px;
    padding: 20px;
}

.flex-grow-1 {
    flex-grow: 1;
}

@media (max-width: 800px) {
    .detail-content-grid {
        grid-template-columns: 1fr;
    }
    .detail-info-item {
        border-right: none;
    }
    .flex-row {
        flex-direction: column;
        gap: 16px;
    }
}

.p-actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

/* ================================================================
   BPM Engine — Styles
   ================================================================ */



/* ── Shared helpers ────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.section-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.85rem; display: flex; align-items: center; gap: 0.5rem; }
.page-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.sidebar-section-title { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.75rem; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.required::after { content: ' *'; color: var(--danger); }

/* Badge aliases for bootstrap-style classes used in templates */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 500; }
.badge-sm { padding: 1px 6px; font-size: 0.7rem; }
.bg-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.bg-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }
.bg-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.bg-primary { background: var(--accent-glow); color: var(--accent-light); border: 1px solid rgba(59,130,246,0.2); }
.bg-secondary { background: rgba(100,116,139,0.15); color: var(--text-secondary); border: 1px solid rgba(100,116,139,0.2); }
.bg-info { background: rgba(6,182,212,0.12); color: #22d3ee; border: 1px solid rgba(6,182,212,0.2); }
.bg-dark { background: rgba(15,23,42,0.8); color: var(--text-secondary); border: 1px solid var(--border); }

/* Table alias */
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table thead th { padding: 0.7rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); background: var(--bg-secondary); border-bottom: 2px solid var(--border); text-transform: uppercase; letter-spacing: 0.3px; }
.table tbody td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--bg-card-hover); }

/* Form grid */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group-span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } .form-group-span-2 { grid-column: 1; } }

/* Priority dots */
.bpm-priority-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.priority-1 { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.6); }
.priority-2 { background: #f59e0b; }
.priority-3 { background: #3b82f6; }
.priority-4 { background: #64748b; }

/* Stats row */
.bpm-stats-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.bpm-stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1.25rem; min-width: 100px; text-align: center; }
.bpm-stat-number { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.bpm-stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.bpm-stat-total .bpm-stat-number { color: var(--accent-light); }
.bpm-stat-open .bpm-stat-number { color: var(--success); }
.bpm-stat-blocked .bpm-stat-number { color: var(--danger); }
.bpm-stat-done .bpm-stat-number { color: var(--text-muted); }

/* Filter card */
.bpm-filters-card { padding: 1rem; }
.bpm-filters-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }

/* Task list */
.bpm-task-blocked td:first-child { border-left: 3px solid var(--danger); }
.bpm-task-blocked { opacity: 0.75; }
.bpm-task-title { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.bpm-task-title:hover { color: var(--accent-light); }

/* Detail layout */
.bpm-detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 1024px) { .bpm-detail-grid { grid-template-columns: 1fr; } }
.bpm-detail-main { display: flex; flex-direction: column; gap: 1.25rem; }
.bpm-detail-sidebar { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: calc(var(--nav-height) + 1rem); }
.bpm-section-collapsed > *:not(.section-title) { display: none; }

/* Meta list */
.bpm-meta-list { margin: 0; }
.bpm-meta-list dt { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-top: 0.5rem; }
.bpm-meta-list dd { font-size: 0.875rem; color: var(--text-primary); margin: 0.15rem 0 0; display: flex; align-items: center; gap: 0.4rem; }

/* Dependencies */
.bpm-deps-list { display: flex; flex-direction: column; gap: 0.5rem; }
.bpm-dep-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.bpm-dep-done { border-color: rgba(16,185,129,0.25); background: rgba(16,185,129,0.04); }
.bpm-dep-pending { border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.04); }
.bpm-dep-content { flex: 1; }
.bpm-dep-title { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); text-decoration: none; }
.bpm-dep-title:hover { color: var(--accent-light); }
.alert-inline { font-size: 0.8rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }

/* Transition buttons */
.bpm-transitions-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.bpm-transition-form { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.btn-bpm-transition { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); color: white; border: none; padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 0.5rem; }
.btn-bpm-transition:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.bpm-transition-target { font-size: 0.75rem; opacity: 0.75; }
.bpm-reason-input { width: 200px; }

/* Comments */
.bpm-comments-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.bpm-comment { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem; }
.bpm-comment-external { border-left: 3px solid #a78bfa; }
.bpm-comment-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.bpm-comment-author { font-weight: 600; font-size: 0.85rem; display: flex; align-items: center; gap: 0.35rem; }
.bpm-comment-time { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
.bpm-comment-body { font-size: 0.875rem; line-height: 1.6; }
.bpm-comment-attachments { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bpm-attachment-link { font-size: 0.78rem; color: var(--accent-light); text-decoration: none; }

/* Links */
.bpm-links-list { display: flex; flex-direction: column; gap: 0.5rem; }
.bpm-link-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }

/* Timeline */
.bpm-timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.bpm-timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 1px; background: var(--border); }
.bpm-timeline-item { display: flex; gap: 0.75rem; padding: 0.5rem 0; align-items: flex-start; position: relative; }
.bpm-timeline-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-secondary); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; flex-shrink: 0; z-index: 1; }
.bpm-timeline-type { font-size: 0.8rem; font-weight: 500; }
.bpm-timeline-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Flows grid */
.bpm-flows-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.bpm-flow-card { transition: var(--transition); }
.bpm-flow-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bpm-flow-inactive { opacity: 0.6; }
.bpm-flow-header { margin-bottom: 0.75rem; }
.bpm-flow-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.35rem; }
.bpm-flow-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.bpm-flow-meta { font-size: 0.78rem; color: var(--text-muted); display: flex; gap: 1rem; margin-bottom: 0.75rem; }
.bpm-flow-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Flow detail */
.bpm-steps-list { display: flex; flex-direction: column; gap: 0.35rem; }
.bpm-step-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.bpm-step-terminal { border-color: rgba(139,92,246,0.3); background: rgba(139,92,246,0.05); }
.bpm-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-glow); color: var(--accent-light); font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bpm-step-content { flex: 1; }
.bpm-step-name { font-size: 0.875rem; font-weight: 500; display: flex; align-items: center; gap: 0.4rem; }
.bpm-step-key { font-family: monospace; font-size: 0.75rem; color: var(--text-muted); }
.bpm-transitions-list { display: flex; flex-direction: column; gap: 0.4rem; }
.bpm-transition-item { padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.bpm-transition-path { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; font-size: 0.82rem; }
.bpm-trans-from, .bpm-trans-to { font-family: monospace; background: var(--bg-secondary); padding: 1px 6px; border-radius: 3px; }
.bpm-transition-details { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* Flow graph */
.bpm-flow-graph { display: flex; gap: 0; align-items: center; flex-wrap: wrap; padding: 0.5rem; }
.bpm-graph-node { padding: 0.4rem 0.85rem; border-radius: 20px; background: var(--bg-secondary); border: 1px solid var(--border); font-size: 0.8rem; position: relative; margin: 0.3rem 1.2rem 0.3rem 0.3rem; white-space: nowrap; }
.bpm-graph-node::after { content: '→'; position: absolute; right: -18px; color: var(--text-muted); font-size: 0.9rem; top: 50%; transform: translateY(-50%); }
.bpm-graph-node:last-child::after { display: none; }
.bpm-graph-start { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: var(--success); }
.bpm-graph-end { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.3); color: #a78bfa; }

/* ── BPM case/task context ─────────────────────────── */
.case-products-overview {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.case-products-summary,
.case-product-chips,
.bpm-process-actions,
.grid-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.case-product-chip {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.bpm-case-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.bpm-case-stat {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
}
.bpm-case-stat strong {
    display: block;
    font-size: 1.25rem;
    line-height: 1.1;
}
.bpm-case-stat span {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}
.bpm-process-strip,
.bpm-open-tasks,
.bpm-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bpm-process-pill,
.bpm-case-task,
.bpm-link-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    text-decoration: none;
    color: inherit;
}
.bpm-process-pill {
    justify-content: space-between;
}
.bpm-case-task:hover,
.bpm-link-card:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}
.bpm-case-task-title,
.bpm-link-main {
    flex: 1;
    min-width: 0;
}
.bpm-link-main {
    display: flex;
    flex-direction: column;
}
.bpm-link-title {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bpm-link-title:hover {
    color: var(--accent-light);
}
.doc-coverage-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.doc-coverage-item {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
}
.doc-coverage-item.is-partial {
    border-color: rgba(245, 158, 11, 0.45);
}
.doc-coverage-head,
.doc-coverage-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
}
.doc-coverage-head span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-coverage-meta {
    color: var(--text-muted);
    margin-top: 4px;
}
.doc-coverage-bar {
    height: 6px;
    margin-top: 7px;
    border-radius: 6px;
    background: var(--bg-input);
    overflow: hidden;
}
.doc-coverage-bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}
.grid-tools {
    justify-content: space-between;
    margin-bottom: 10px;
}
.grid-tools .search-with-icon {
    flex: 1;
    min-width: 260px;
}

@media (max-width: 860px) {
    .bpm-case-summary {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
    .bpm-process-pill,
    .bpm-case-task {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ── Sort Links ────────────────────────────────────── */
.sort-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}
.sort-link:hover {
    color: var(--accent);
}
.sort-link i {
    font-size: 0.7rem;
    opacity: 0.5;
    transition: all 0.2s;
}
.sort-link.active {
    color: var(--accent);
    font-weight: 600;
}
.sort-link.active i {
    opacity: 1;
    color: var(--accent);
}

/* ── Collapsible cells (Audit Trail) ───────────────── */
.collapsible-cell {
    position: relative;
}
.btn-toggle-expand {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.75rem;
    opacity: 0.6;
}
.btn-toggle-expand:hover {
    opacity: 1;
}
.expanded-content { 
    font-family: 'Inter', sans-serif; 
    white-space: pre-wrap; 
    font-size: 0.8rem; 
    background: rgba(0,0,0,0.03); 
    padding: 8px; 
    border-radius: 4px; 
    border-left: 3px solid var(--accent);
    margin-top: 5px;
}

/* ── Change Analysis View & Print Styles ────────────── */
.analysis-document { background: white; padding: 40px; border: 1px solid #ccc; color: black; font-family: 'Inter', sans-serif; max-width: 1000px; margin: 0 auto; }
.doc-header { margin-bottom: 30px; }
.doc-title-box { border: 2px solid black; padding: 10px; text-align: center; margin-bottom: 20px; }
.org-name { font-weight: bold; font-size: 1.1em; margin: 0; }
.doc-id { font-size: 0.75em; margin: 0; }

.doc-main-table { width: 100%; border-top: 1px solid black; border-left: 1px solid black; }
.doc-main-table .row { display: flex; border-bottom: 1px solid black; }
.doc-main-table .cell { padding: 6px 12px; border-right: 1px solid black; display: flex; align-items: center; }
.cell.label { width: 280px; background: #f5f5f5; font-size: 0.8em; font-weight: bold; }
.cell.val { flex-grow: 1; font-size: 0.9em; }

.doc-section h3 { 
    font-size: 0.85em; 
    background: #e0e0e0; 
    color: black; 
    padding: 6px 12px; 
    margin-bottom: 8px; 
    border-left: 5px solid #666; 
}
.doc-box { border: 1px solid #333; padding: 12px; font-size: 0.85em; line-height: 1.4; }
.min-h-100 { min-height: 80px; }

.impact-view-table { width: 100%; border-collapse: collapse; margin-top: 5px; border: 1px solid #333; }
.impact-view-table th, .impact-view-table td { border: 1px solid #333; padding: 8px 12px; font-size: 0.75em; }
.impact-view-table th { background: #f5f5f5; font-weight: bold; text-transform: none; }

.checklist-view-expanded { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 25px; border: 1px solid #333; padding: 15px; background: white; }
.view-header { grid-column: 1 / -1; background: #f0f0f0; font-weight: bold; font-size: 0.75em; padding: 5px 10px; margin-top: 5px; border-bottom: 1px solid #ddd; }
.view-item { font-size: 0.7em; display: flex; gap: 6px; color: #666; line-height: 1.3; }
.view-item.checked { color: black; font-weight: bold; }
.view-item.indent-1 { padding-left: 15px; }
.view-item.indent-2 { padding-left: 30px; }
.view-item .icon { font-size: 1.4em; line-height: 0.6; margin-top: -2px; }

.distribute-footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid #eee; padding-top: 20px; }
.footer-col { flex: 1; display: flex; flex-direction: column; }
.footer-label { font-size: 0.75em; font-weight: bold; margin-bottom: 6px; color: #333; }
.signature-box { border: 1px solid #333; height: 70px; padding: 8px; font-size: 0.75em; position: relative; display: flex; flex-direction: column; justify-content: center; }
.digital-sign-box { background: #fafafa; border: 1px dashed #999; }
.placeholder { color: #aaa; font-style: italic; font-size: 0.8em; }
.adobe-hint { position: absolute; bottom: 4px; right: 4px; font-size: 0.6em; color: #bbb; pointer-events: none; }

@media print {
    body * { visibility: hidden; }
    .analysis-document, .analysis-document * { visibility: visible; }
    .analysis-document { position: absolute; left: 0; top: 0; border: none; padding: 0px; width: 100%; max-width: none; }
    .no-print { display: none !important; }
}
