<?php
/**
 * فرآتیکت (FaraTicket) — Main CSS
 * استایل‌های اختصاصی پروژه
 */

// This is CSS, not PHP — but we serve it via PHP for dynamic headers if needed.
// In production, use the static app.css file instead.
header('Content-Type: text/css');
?>
@charset "UTF-8";

/* --- Vazir Font --- */
@font-face {
    font-family: 'Vazir';
    src: url('../webfonts/Vazir.woff2') format('woff2');
    font-weight: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazir';
    src: url('../webfonts/Vazir-Bold.woff2') format('woff2');
    font-weight: bold;
    font-display: swap;
}
@font-face {
    font-family: 'Vazir';
    src: url('../webfonts/Vazir-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

:root {
    --primary: #1a1a2e;
    --secondary: #0f3460;
    --accent: #e17055;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
    --info: #74b9ff;
    --light-bg: #f8f9fa;
}

* {
    font-family: 'Vazir', Tahoma, Arial, sans-serif;
}

body {
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Navbar --- */
.main-navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 2px 15px rgba(0,0,0,0.15);
    padding: 0.5rem 1rem;
}
.main-navbar .navbar-brand {
    font-size: 1.5rem;
    font-weight: 900;
}
.brand-fara { color: #fff; }
.brand-ticket { color: var(--accent); }
.main-navbar .nav-link {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
}
.main-navbar .nav-link:hover,
.main-navbar .nav-link.active {
    background: rgba(255,255,255,0.1);
}
.main-navbar .dropdown-menu {
    border: none;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    border-radius: 12px;
    margin-top: 8px;
}
.main-navbar .dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}
.main-navbar .dropdown-item:hover {
    background: var(--light-bg);
}
.main-navbar .dropdown-item i {
    margin-left: 8px;
    width: 18px;
}
.notif-menu {
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
    font-weight: bold;
}

/* --- Stat Cards --- */
.stat-card {
    padding: 1.25rem;
    border-radius: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
    position: absolute;
    left: 15px;
    bottom: 10px;
}
.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 900;
}
.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}
.stat-card.primary { background: linear-gradient(135deg, #1a1a2e, #0f3460); }
.stat-card.success { background: linear-gradient(135deg, #00b894, #00cec9); }
.stat-card.warning { background: linear-gradient(135deg, #fdcb6e, #e17055); }
.stat-card.danger { background: linear-gradient(135deg, #d63031, #e17055); }
.stat-card.info { background: linear-gradient(135deg, #74b9ff, #0984e3); }
.stat-card.accent { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.stat-card.star { background: linear-gradient(135deg, #e17055, #fdcb6e); }

/* --- Buttons --- */
.btn {
    border-radius: 10px;
    font-size: 0.9rem;
    padding: 0.5rem 1.2rem;
}
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--secondary); border-color: var(--secondary); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #d35400; border-color: #d35400; color: #fff; }

/* --- Forms --- */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,26,46,0.1);
}
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* --- Tables --- */
.table {
    font-size: 0.9rem;
}
.table th {
    font-weight: 600;
    background: var(--light-bg);
    border-bottom: 2px solid #dee2e6;
}
.table-hover tbody tr:hover {
    background: rgba(225,112,85,0.05);
}

/* --- Alerts --- */
.alert {
    border: none;
    border-radius: 12px;
}

/* --- Modal --- */
.modal-content {
    border: none;
    border-radius: 16px;
}
.modal-header {
    border-bottom: 1px solid #e9ecef;
}
.modal-footer {
    border-top: 1px solid #e9ecef;
}

/* --- Badges --- */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-right: 30px;
}
.timeline::before {
    content: '';
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}
.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}
.timeline-item::before {
    content: '';
    position: absolute;
    right: -22px;
    top: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
}
.timeline-item.approved::before { background: var(--success); }
.timeline-item.rejected::before { background: var(--danger); }
.timeline-item.pending::before { background: var(--warning); }
.timeline-item.created::before { background: var(--info); }

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* --- Auth Pages --- */
.auth-container {
    max-width: 420px;
    margin: 80px auto;
}
.auth-card {
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo h2 {
    font-size: 2rem;
    font-weight: 900;
}
.auth-logo h2 span { color: var(--accent); }

/* --- Wizard Steps --- */
.wizard-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.wizard-step {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #b2bec3;
    font-size: 0.85rem;
}
.wizard-step.active {
    color: var(--primary);
    font-weight: bold;
}
.wizard-step.completed {
    color: var(--success);
}
.wizard-step .step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    font-weight: bold;
    font-size: 0.8rem;
}
.wizard-step.active .step-num { background: var(--primary); color: #fff; }
.wizard-step.completed .step-num { background: var(--success); color: #fff; }
.wizard-connector {
    width: 40px;
    height: 2px;
    background: #e9ecef;
    margin: 0 5px;
}
.wizard-connector.completed { background: var(--success); }

/* --- Print Header Designer --- */
.print-header-preview {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 20px;
    min-height: 150px;
    text-align: center;
    background: #fff;
    margin-bottom: 15px;
}
.print-header-preview img {
    max-height: 60px;
    margin-bottom: 10px;
}

/* --- Smooth Transitions --- */
.card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}
.btn {
    transition: all 0.15s ease;
}
.btn:hover {
    transform: translateY(-1px);
}
.stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}
.kpi-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.table-hover tbody tr {
    transition: background 0.12s ease;
}

/* --- Help Icons --- */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    font-size: 0.7rem;
    cursor: help;
    margin-right: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}
.help-tip:hover {
    background: var(--primary);
    color: #fff;
}

/* --- Fade In --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-card, .kpi-card, .filter-panel {
    animation: fadeInUp 0.3s ease both;
}
.dashboard-grid .stat-card:nth-child(2) { animation-delay: 0.05s; }
.dashboard-grid .stat-card:nth-child(3) { animation-delay: 0.1s; }
.dashboard-grid .stat-card:nth-child(4) { animation-delay: 0.15s; }

/* --- Form Preview Mockup --- */
.preview-mockup {
    position: relative;
    margin-top: 0.5rem;
}
.preview-mockup::before {
    content: "ماکت";
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 2;
    opacity: 0.7;
}
.preview-mockup-inner {
    transform: scale(0.85);
    transform-origin: top center;
    background: #fff;
    border: 2px dashed #adb5bd;
    border-radius: 12px;
    padding: 1rem;
    pointer-events: none;
    user-select: none;
}
.preview-mockup-inner .form-label,
.preview-mockup-inner .form-control,
.preview-mockup-inner .form-select {
    font-size: 0.75rem !important;
}
.preview-mockup-inner input[disabled],
.preview-mockup-inner select[disabled],
.preview-mockup-inner textarea[disabled] {
    opacity: 0.5;
    cursor: default;
}

@media print {
    .main-navbar, .footer-bar, .no-print { display: none !important; }
    .card { box-shadow: none; border: 1px solid #dee2e6; }
    body { background: #fff; }
    .container-fluid { padding: 0; margin: 0; max-width: 100%; }
    @page { margin: 2cm; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    .stat-card .stat-number {
        font-size: 1.5rem;
    }
    .main-navbar .navbar-brand {
        font-size: 1.2rem;
    }
}
@media (max-width: 576px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* --- KPI Cards --- */
.kpi-card {
    padding: 1rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e9ecef;
    text-align: center;
}
.kpi-card .kpi-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
}
.kpi-card .kpi-label {
    font-size: 0.8rem;
    color: var(--primary);
}
.kpi-card .kpi-change {
    font-size: 0.75rem;
    margin-top: 5px;
}
.kpi-card .kpi-change.up { color: var(--success); }
.kpi-card .kpi-change.down { color: var(--danger); }

/* --- Filter Panel --- */
.filter-panel {
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

/* --- Ticket Number Link --- */
.ticket-num-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
}
.ticket-num-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* --- Tree View --- */
.tree-view ul {
    list-style: none;
    padding-right: 20px;
}
.tree-view > ul {
    padding-right: 0;
}
.tree-view li {
    padding: 5px 0;
    position: relative;
}
.tree-view li::before {
    content: '— ';
    color: #b2bec3;
}
.tree-view li.has-children::before {
    content: '📁 ';
}
.tree-view li:not(.has-children)::before {
    content: '📄 ';
}

/* --- Chat / Conversation Styles --- */
.chat-container {
    max-height: 480px;
    overflow-y: auto;
    padding: 1rem;
    background: #f0f2f5;
    scroll-behavior: smooth;
}
.chat-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 1rem;
    gap: 0.5rem;
}
.chat-row-own {
    flex-direction: row-reverse;
}
.chat-row-other {
    flex-direction: row;
}
.chat-avatar-col {
    flex-shrink: 0;
}
.chat-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
    color: #fff;
    background: #6c757d;
}
.chat-avatar.role-expert,
.chat-avatar.role-operator { background: #0dcaf0; }
.chat-avatar.role-manager,
.chat-avatar.role-admin { background: #0d6efd; }
.chat-avatar.role-super_admin { background: #ffc107; color: #212529; }
.chat-avatar.role-user,
.chat-avatar.role-viewer { background: #6c757d; }

.chat-body-col {
    max-width: 75%;
}
.chat-sender-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
    padding-right: 0.5rem;
    font-size: 0.8rem;
}
.chat-sender-info strong {
    font-size: 0.85rem;
}
.chat-row-own .chat-sender-info {
    display: none;
}
.chat-bubble {
    border-radius: 14px;
    padding: 0.6rem 0.9rem;
    position: relative;
    word-break: break-word;
    line-height: 1.55;
}
.chat-bubble-own {
    background: linear-gradient(135deg, #005c97, #1a73e8);
    color: #fff;
    border-bottom-left-radius: 4px;
}
.chat-row-own:first-child .chat-bubble-own {
    border-bottom-left-radius: 14px;
}
.chat-bubble-other {
    background: #fff;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-bottom-right-radius: 4px;
}
.chat-row-other:first-child .chat-bubble-other {
    border-bottom-right-radius: 14px;
}
.chat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.35rem;
    gap: 0.5rem;
}
.chat-time {
    font-size: 0.7rem;
    opacity: 0.7;
}
.chat-bubble-own .chat-time {
    color: rgba(255,255,255,0.85);
}
.chat-bubble-other .chat-time {
    color: #6c757d;
}
.chat-reply-link,
.chat-edit-link,
.chat-del-link {
    font-size: 0.7rem;
    padding: 0 0.3rem;
    border: none;
    background: none;
    cursor: pointer;
}
.chat-bubble-own .chat-reply-link,
.chat-bubble-own .chat-edit-link,
.chat-bubble-own .chat-del-link {
    color: rgba(255,255,255,0.85);
}
.chat-bubble-other .chat-reply-link,
.chat-bubble-other .chat-edit-link,
.chat-bubble-other .chat-del-link {
    color: #6c757d;
}
.chat-bubble-other .chat-edit-link:hover { color: #0d6efd; }
.chat-bubble-other .chat-del-link:hover { color: #dc3545; }
.chat-bubble-own .chat-edit-link:hover,
.chat-bubble-own .chat-del-link:hover { opacity: 0.8; }
.chat-empty {
    text-align: center;
    color: #6c757d;
    padding: 2rem 0;
}
.chat-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}
.chat-input-area {
    border-top: 1px solid #dee2e6;
    background: #fff;
}
.chat-input {
    resize: none;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    outline: none;
    box-shadow: none;
    max-height: 120px;
}
.chat-input:focus {
    box-shadow: none;
}
.chat-send-btn {
    border-radius: 0;
    padding: 0.75rem 1.2rem;
}
.chat-reply-indicator {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.8rem;
    gap: 0.5rem;
}
.chat-reply-indicator .bi {
    font-size: 0.9rem;
}
.chat-cancel-reply {
    margin-right: auto;
}

/* Reply chain preview inside bubble */
.chat-reply-preview {
    border-right: 3px solid rgba(255,255,255,0.5);
    padding-right: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    opacity: 0.85;
}
.chat-bubble-other .chat-reply-preview {
    border-right-color: #adb5bd;
}
.chat-reply-preview-sender {
    font-weight: 600;
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
}
.chat-reply-preview-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Edited badge */
.chat-edited-badge {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-bottom: 0.2rem;
    font-style: italic;
}

/* Consecutive message grouping */
.chat-row-grouped {
    margin-bottom: 0.35rem;
}
.chat-row-grouped .chat-avatar-col {
    visibility: hidden;
    width: 36px;
}
.chat-row-grouped .chat-sender-info {
    display: none;
}
.chat-row-grouped .chat-bubble {
    border-top-left-radius: 4px;
    border-top-right-radius: 14px;
}
.chat-row-grouped.chat-row-own .chat-bubble {
    border-top-left-radius: 14px;
    border-top-right-radius: 4px;
}
.chat-row-grouped:last-child .chat-bubble {
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}

/* === Tree Manager === */
.tree-container {
    min-height: 200px;
    padding: 8px 0;
}

.tree-list {
    list-style: none;
    padding-right: 24px;
    margin: 4px 0;
}

.tree-list > .tree-list {
    padding-right: 32px;
}

.tree-node {
    margin: 2px 0;
    transition: all 0.15s;
}

.tree-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #dee2e6;
    cursor: default;
    user-select: none;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.tree-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 1px 4px rgba(13, 110, 253, 0.15);
}

.tree-dragging > .tree-card {
    opacity: 0.4;
    border-style: dashed;
}

.tree-drop-target > .tree-card {
    border-color: #198754;
    background: #f0fff4;
    box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.25);
}

.tree-toggle,
.tree-toggle-placeholder {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.tree-toggle:hover {
    background: #e9ecef;
}

.tree-toggle-placeholder {
    cursor: default;
    visibility: hidden;
}

.tree-drag-handle {
    flex-shrink: 0;
    cursor: grab;
    color: #adb5bd;
    padding: 0 2px;
    transition: color 0.15s;
}

.tree-drag-handle:hover {
    color: #495057;
}

.tree-drag-handle:active {
    cursor: grabbing;
}

.tree-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f0f2f5;
    color: #495057;
    font-size: 0.85rem;
}

.tree-title {
    flex: 1;
    font-size: 0.925rem;
    font-weight: 500;
    color: #212529;
    min-width: 60px;
    padding: 0 4px;
    border-radius: 4px;
}

.tree-title:hover {
    background: #e9ecef;
}

.tree-access-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
}

.tree-user-count {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
}

.tree-user-count i {
    margin-left: 2px;
}

.tree-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.tree-card:hover .tree-actions {
    opacity: 1;
}

.tree-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    border-radius: 4px;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    font-size: 0.85rem;
    line-height: 1;
}

.tree-btn:hover {
    background: #e9ecef;
}

.tree-btn.tree-add-child:hover { color: #0d6efd; }
.tree-btn.tree-rename:hover { color: #198754; }
.tree-btn.tree-delete:hover { color: #dc3545; }

.tree-access-editor {
    display: none;
}

.tree-access-select {
    font-size: 0.75rem;
    padding: 1px 4px;
    height: auto;
    min-width: 80px;
}

.tree-rename-input {
    flex: 1;
    font-size: 0.925rem;
    padding: 0 6px;
    height: 30px;
    min-width: 80px;
}

.tree-card-new .tree-new-input {
    flex: 1;
    font-size: 0.925rem;
    height: 30px;
}

.tree-card-new .tree-new-access {
    font-size: 0.75rem;
    height: 30px;
    width: auto;
    min-width: 70px;
}

.tree-new-confirm,
.tree-new-cancel {
    padding: 0 8px;
    height: 30px;
    font-size: 0.8rem;
}

.tree-new-confirm { margin-right: 4px; }

/* Root add button spacing */
.add-root-node {
    font-size: 0.85rem;
}

/* Nav tabs inside card */
.card .nav-tabs {
    border-bottom-color: #dee2e6;
}

.card .nav-tabs .nav-link {
    color: #495057;
}

.card .nav-tabs .nav-link.active {
    font-weight: 500;
}

/* Action bar */
.add-root-node i {
    margin-left: 4px;
}

/* === Tree User List === */
.tree-user-list {
    list-style: none;
    padding: 0;
    margin: 2px 0 4px 0;
    padding-right: 44px;
}

.tree-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f8f9fa;
    margin: 2px 0;
    border: 1px solid #e9ecef;
    transition: background 0.15s;
}

.tree-user-item:hover {
    background: #fff;
    border-color: #dee2e6;
}

.tree-user-avatar {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4a6cf7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.tree-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tree-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #212529;
    line-height: 1.3;
}

.tree-user-mobile {
    font-size: 0.75rem;
    color: #6c757d;
    direction: ltr;
    text-align: left;
}

.tree-user-extra {
    display: flex;
    gap: 8px;
    font-size: 0.7rem;
    color: #adb5bd;
    margin-top: 1px;
    flex-wrap: wrap;
}

.tree-user-extra i {
    font-size: 0.65rem;
    margin-left: 2px;
}

.tree-user-level-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 20px;
    flex-shrink: 0;
}

.tree-user-status-active,
.tree-user-status-inactive {
    flex-shrink: 0;
    font-size: 0.85rem;
    line-height: 1;
}

.tree-user-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.tree-user-item:hover .tree-user-actions {
    opacity: 1;
}

.tree-user-actions .tree-btn:hover { background: #dee2e6; }

.tree-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.35);
}

.tree-popup-form {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    font-size: 0.85rem;
    overflow: hidden;
}

.tree-popup-form .tree-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    font-size: 0.9rem;
}

.tree-popup-form .tree-popup-header .btn-close {
    font-size: 0.7rem;
}

.tree-popup-form .tree-popup-body {
    padding: 12px 14px;
}

.tree-popup-form .tree-popup-label {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 2px;
}

.tree-popup-form .tree-popup-footer {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.tree-popup-form .tree-popup-footer .btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
}

.tree-add-root {
    font-size: 0.85rem;
}

.tree-add-root i {
    margin-left: 4px;
}

/* ─── Process Flowchart Nodes ─── */
.fc-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
    position: relative;
}
.fc-node {
    width: 100%;
    max-width: 440px;
    background: #f8f9fb;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: default;
    position: relative;
    padding: 10px 14px;
}
.fc-wrap:hover .fc-node {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.fc-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.fc-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}
.fc-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #e9ecef;
    color: #495057;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.fc-badge {
    display: inline-block;
    padding: 2px 8px;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
    flex-shrink: 0;
}
.fc-title {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fc-actions {
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.3;
    transition: opacity 0.15s;
}
.fc-wrap:hover .fc-actions { opacity: 1; }
.fc-body {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dotted #dee2e6;
    font-size: 0.78rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.fc-detail {
    color: #6c757d;
}
.fc-return {
    background: #0dcaf0;
    color: #fff;
    padding: 1px 6px;
    font-size: 0.72rem;
}
.fc-operator {
    display: inline-block;
    padding: 0 4px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0d6efd;
}
/* Start / End nodes */
.fc-start-end .fc-node {
    border-width: 2px;
    padding: 6px 20px;
}
.fc-start-node {
    border-radius: 50px !important;
    background: #e8f5e9 !important;
    border-color: #198754 !important;
}
.fc-end-node {
    border-radius: 50px !important;
    background: #ffebee !important;
    border-color: #dc3545 !important;
}
.fc-row-center {
    justify-content: center;
}
.fc-title-center {
    text-align: center;
}
/* Condition return connector */
.fc-return-connector {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    font-size: 0.72rem;
    border-right: 3px dashed #ffc107;
    margin-top: 2px;
    width: 100%;
}
/* Dimmer arrow for read-only start node */
.fc-arrow-dim .fc-arrow-line,
.fc-arrow-dim .fc-arrow-head {
    border-color: #adb5bd;
}
/* Flowchart arrow ── line + triangle */
.fc-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    line-height: 0;
}
.fc-arrow-line {
    width: 2px;
    height: 14px;
    background: #adb5bd;
    transition: background 0.15s;
}
.fc-arrow-head {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #adb5bd;
    transition: border-top-color 0.15s;
}


