*{box-sizing:border-box;margin:0;padding:0}
*{box-sizing:border-box}html,body{margin:0;padding:0;height:100%}body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:#f5f6fa;color:#2d3748}
.layout{display:flex;height:100vh;overflow:hidden}
.sidebar{width:240px;background:#1a202c;color:#e2e8f0;padding:0;flex-shrink:0;display:flex;flex-direction:column;overflow-y:auto;transition:width .25s ease}
.sidebar-logo{padding:20px 24px;font-size:18px;font-weight:700;border-bottom:1px solid #2d3748;color:#63b3ed;display:flex;align-items:center;white-space:nowrap;overflow:hidden}
.sidebar-logo-icon{flex-shrink:0}
.sidebar-logo-text{overflow:hidden;transition:opacity .2s,max-width .25s ease;max-width:200px;opacity:1}
.sidebar.collapsed{width:60px;overflow:hidden}
.sidebar.collapsed .sidebar-logo{padding:20px 0;justify-content:center}
.sidebar.collapsed .sidebar-logo-text{max-width:0;opacity:0}
.sidebar.collapsed .nav-section{display:none}
.sidebar.collapsed .nav-section-items{max-height:9999px!important;overflow:visible!important}
.sidebar.collapsed .nav-item{padding:10px;justify-content:center;font-size:0;position:relative}
.sidebar.collapsed .nav-item svg{margin-right:0;flex-shrink:0}
.sidebar.collapsed .nav-item:hover::after{content:attr(data-title);position:absolute;left:64px;background:#2d3748;color:#e2e8f0;padding:4px 10px;border-radius:6px;font-size:13px;white-space:nowrap;z-index:999;pointer-events:none;box-shadow:0 2px 8px rgba(0,0,0,.25)}
.sidebar-toggle{background:none;border:none;cursor:pointer;padding:6px;border-radius:6px;color:#4a5568;display:flex;align-items:center;margin-right:8px;flex-shrink:0}
.sidebar-toggle:hover{background:#e2e8f0}
.sidebar-nav{padding:16px 0;flex:1}
.nav-section{padding:8px 24px 4px;font-size:13px;text-transform:uppercase;letter-spacing:.08em;color:#718096;display:flex;align-items:center;justify-content:space-between;cursor:pointer;user-select:none;transition:color .15s;font-weight:600}
.nav-section:hover{color:#a0aec0}
.nav-chevron{flex-shrink:0;transition:transform .2s;margin-right:20px;opacity:.6}
.nav-section.collapsed .nav-chevron{transform:rotate(-90deg)}
.nav-section-items{overflow:hidden;transition:max-height .25s ease}
.nav-section-items.collapsed{max-height:0!important}
.nav-item{display:flex;align-items:center;padding:10px 24px;color:#a0aec0;text-decoration:none;font-size:14px;transition:.15s;cursor:pointer;border:none;background:none;width:100%;text-align:left}
.nav-item:hover,.nav-item.active{background:#2d3748;color:#fff}
.nav-item svg{margin-right:10px;flex-shrink:0}
.main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
.topbar{background:#fff;padding:0 24px;height:60px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #e2e8f0;box-shadow:0 1px 3px rgba(0,0,0,.05)}
.topbar-title{font-size:16px;font-weight:600}
.topbar-user{display:flex;align-items:center;gap:12px;font-size:14px;color:#4a5568}
.page-tabs-wrap{display:flex;flex-direction:row;align-items:flex-end;background:#fff;border-bottom:2px solid #4299e1;height:44px;flex-shrink:0;gap:0;padding:0 4px}
.tab-scroll-btn{flex-shrink:0;width:28px;height:40px;background:none;border:none;cursor:pointer;color:#a0aec0;font-size:18px;display:flex;align-items:center;justify-content:center;padding:0}
.tab-scroll-btn:hover{color:#4299e1}
.tab-scroll-btn:disabled{opacity:.3;cursor:default}
.page-tabs{display:flex;flex-direction:row;align-items:flex-end;flex:1;height:44px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;gap:2px;padding:0 4px}
.page-tabs::-webkit-scrollbar{display:none}
.tab-more-btn{flex-shrink:0;width:36px;height:40px;border:none;border-left:1px solid #d8dde6;background:none;cursor:pointer;color:#606266;font-size:16px;display:flex;align-items:center;justify-content:center;position:relative}
.tab-more-btn:hover{background:#e4e7ed}
.tab-dropdown{position:absolute;top:36px;right:0;z-index:1000;background:#fff;border:1px solid #e2e8f0;border-radius:6px;box-shadow:0 4px 16px rgba(0,0,0,.12);min-width:180px;display:none;max-height:400px;overflow-y:auto}
.tab-dropdown.show{display:block}
.tab-dropdown-item{display:flex;align-items:center;gap:8px;padding:8px 14px;font-size:13px;cursor:pointer;color:#2d3748;transition:background .12s}
.tab-dropdown-item:hover{background:#f7fafc}
.tab-dropdown-item.active-item{color:#4299e1;font-weight:600}
.tab-ctx-menu{position:fixed;z-index:9999;background:#fff;border:1px solid #e2e8f0;border-radius:6px;box-shadow:0 4px 16px rgba(0,0,0,.15);min-width:160px;display:none;padding:4px 0}
.tab-ctx-menu.show{display:block}
.tab-ctx-item{padding:7px 16px;font-size:13px;cursor:pointer;color:#2d3748;transition:background .12s}
.tab-ctx-item:hover{background:#f7fafc}
.tab-ctx-item.danger{color:#e53e3e}
.tab-ctx-item.danger:hover{background:#fff5f5}
.tab-ctx-sep{height:1px;background:#e2e8f0;margin:3px 0}
.content{flex:1;padding:24px;overflow-y:auto}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.08);padding:24px;margin-bottom:20px}
.card-title{font-size:16px;font-weight:600;margin-bottom:16px;padding-bottom:12px;border-bottom:1px solid #e2e8f0}
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}
.stat-card{background:#fff;border-radius:8px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.08);border-left:4px solid}
.stat-card:nth-child(1){border-color:#4299e1}.stat-card:nth-child(2){border-color:#48bb78}.stat-card:nth-child(3){border-color:#ed8936}.stat-card:nth-child(4){border-color:#9f7aea}
.stat-value{font-size:28px;font-weight:700;color:#2d3748}
.stat-label{font-size:13px;color:#718096;margin-top:4px}
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;border:none;transition:.15s}
.btn-primary{background:#4299e1;color:#fff}.btn-primary:hover{background:#3182ce}
.btn-danger{background:#fc8181;color:#fff}.btn-danger:hover{background:#f56565}
.btn-outline{background:#fff;color:#4a5568;border:1px solid #e2e8f0}.btn-outline:hover{background:#f7fafc}
.btn-sm{padding:6px 12px;font-size:13px}
.media-folder-item{color:#4a5568;border-radius:0;transition:.1s}
.media-folder-item:hover{background:#edf2f7}
.media-folder-active{background:#ebf8ff;color:#2b6cb0;font-weight:500}
.form-group{margin-bottom:16px}
.form-label{display:block;font-size:13px;font-weight:500;margin-bottom:6px;color:#4a5568}
.form-input{width:100%;padding:8px 12px;border:1px solid #e2e8f0;border-radius:6px;font-size:14px;transition:.15s}
.form-input:focus{outline:none;border-color:#4299e1;box-shadow:0 0 0 3px rgba(66,153,225,.15)}
textarea.form-input{min-height:120px;resize:vertical;font-family:inherit}
.table{width:100%;border-collapse:collapse;font-size:14px}
.table th{text-align:left;padding:10px 12px;background:#f7fafc;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:#718096;border-bottom:1px solid #e2e8f0}
.table td{padding:12px;border-bottom:1px solid #f0f4f8;vertical-align:middle}
.table tr:last-child td{border-bottom:none}
.table tr:hover td{background:#f7fafc}
.badge{display:inline-flex;padding:2px 8px;border-radius:12px;font-size:12px;font-weight:500}
.badge-green{background:#c6f6d5;color:#276749}.badge-gray{background:#e2e8f0;color:#4a5568}.badge-orange{background:#feebc8;color:#7b341e}.badge-blue{background:#bee3f8;color:#2a4365}.badge-purple{background:#e9d8fd;color:#553c9a}
.modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1000;align-items:center;justify-content:center}
.modal.active{display:flex}
.modal-box,.modal-content{background:#fff;border-radius:10px;width:90%;max-width:560px;max-height:90vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal-header{padding:20px 24px;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center}
.modal-title{font-size:16px;font-weight:600}
.modal-close{background:none;border:none;font-size:20px;cursor:pointer;color:#718096;line-height:1}
.modal-body{padding:24px}
.modal-footer{padding:16px 24px;border-top:1px solid #e2e8f0;display:flex;justify-content:flex-end;gap:12px}
#toast{position:fixed;top:20px;right:20px;z-index:9999;display:flex;flex-direction:column;gap:8px}
.toast-item{padding:12px 20px;border-radius:8px;font-size:14px;font-weight:500;color:#fff;box-shadow:0 4px 12px rgba(0,0,0,.15);animation:slideIn .3s ease;min-width:200px}
.toast-success{background:#48bb78}.toast-error{background:#fc8181}.toast-info{background:#4299e1}
@keyframes slideIn{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}
.spinner{display:inline-block;width:16px;height:16px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .6s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.ai-output{background:#1a202c;color:#e2e8f0;border-radius:8px;padding:16px;font-family:'Courier New',monospace;font-size:13px;line-height:1.6;min-height:200px;max-height:400px;overflow-y:auto;white-space:pre-wrap;word-break:break-word}
.section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.empty-state{text-align:center;padding:48px;color:#a0aec0}
.empty-state svg{margin:0 auto 16px;display:block;opacity:.4}
select.form-input{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:32px;-webkit-appearance:none}
.site-tab{padding:10px 18px;border:none;background:none;font-size:14px;font-weight:500;color:#718096;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:.15s}
.site-tab:hover{color:#2d3748}.site-tab.active-tab{color:#4299e1;border-bottom-color:#4299e1}
.info-row{display:flex;gap:8px;align-items:center;padding:10px 0;border-bottom:1px solid #f0f4f8;font-size:14px}
.info-row:last-child{border:none}.info-label{color:#718096;width:120px;flex-shrink:0}
body.dark-mode{background-color:#1a1a2e;color:#e0e0e0}
body.dark-mode .card{background-color:#16213e;border-color:#0f3460;color:#e0e0e0}
body.dark-mode .navbar,body.dark-mode .sidebar{background-color:#0f3460!important}
body.dark-mode .topbar{background-color:#0f3460;border-color:#1a1a2e}
body.dark-mode .sidebar-toggle{color:#b0b8d1}
body.dark-mode .sidebar-toggle:hover{background:#1a2a4a}
body.dark-mode #user-menu{background:#1e2a3a;border-color:#2d3748;box-shadow:0 4px 16px rgba(0,0,0,.4)}
body.dark-mode #user-menu button{color:#e2e8f0}
body.dark-mode #user-menu button:last-child{color:#fc8181}
.flow-palette-item:hover{background:#ebf8ff!important;border-color:#bee3f8!important}
.flow-node-del{opacity:0;transition:opacity .15s}.flow-node-grp:hover .flow-node-del{opacity:1}
body.dark-mode .page-tabs-wrap{background:#161b22;border-color:#30363d}
body.dark-mode .page-tab{background:#21262d;color:#8b949e;border-color:#30363d}
body.dark-mode .page-tab:hover{background:#30363d;color:#c9d1d9}
body.dark-mode .page-tab.active{background:#0d1117;color:#58a6ff;border-color:#30363d}
body.dark-mode .page-tabs{background:#1a1a2e}
body.dark-mode .tab-scroll-btn{border-color:#2d3748;color:#a0aec0}
body.dark-mode .tab-scroll-btn:hover{background:#2d3748;color:#e2e8f0}
body.dark-mode .tab-more-btn{border-color:#2d3748;color:#a0aec0}
body.dark-mode .tab-more-btn:hover{background:#2d3748;color:#e2e8f0}
body.dark-mode .page-tab{color:#a0aec0;border-color:#2d3748}
body.dark-mode .page-tab:hover{background:#2d3748;color:#e2e8f0}
body.dark-mode .page-tab.active{background:#0f3460;color:#90cdf4;border-top-color:#4299e1;border-bottom-color:#0f3460}
body.dark-mode .tab-dropdown{background:#1e2a3a;border-color:#2d3748}
body.dark-mode .tab-dropdown-item{color:#e2e8f0}
body.dark-mode .tab-dropdown-item:hover{background:#2d3748}
body.dark-mode .tab-ctx-menu{background:#1e2a3a;border-color:#2d3748}
body.dark-mode .tab-ctx-item{color:#e2e8f0}
body.dark-mode .tab-ctx-item:hover{background:#2d3748}
body.dark-mode .table{color:#e0e0e0}
body.dark-mode .table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}
body.dark-mode .modal-content,body.dark-mode .modal-box{background:#16213e!important;color:#e0e0e0}
body.dark-mode .modal-header,body.dark-mode .modal-footer{border-color:#0f3460}
body.dark-mode .form-control,body.dark-mode .form-input,body.dark-mode .form-select{background-color:#0f3460;color:#e0e0e0;border-color:#1a1a2e}
body.dark-mode .bg-light{background-color:#1a1a2e!important}
body.dark-mode .text-muted{color:#aaaaaa!important}
body.dark-mode .border{border-color:#0f3460!important}
body.dark-mode .sidebar{background:#0f3460}
body.dark-mode .nav-item{color:#b0b8d1}
body.dark-mode .nav-item:hover,body.dark-mode .nav-item.active{background:rgba(255,255,255,.08);color:#fff}
body.dark-mode .stat-card{background:#16213e;color:#e0e0e0}
body.dark-mode .info-row{border-color:#0f3460}
body.dark-mode .topbar-user{color:#b0b8d1}
body.dark-mode select.form-input{background-color:#0f3460;color:#e0e0e0}

/* ── Tag Input (node-sources user IDs) ─────────────────────────────────────── */
.tag-input-wrap{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 10px;border:1px solid #e2e8f0;border-radius:6px;background:#fff;cursor:text;min-height:38px}
.tag-input-wrap:focus-within{border-color:#4299e1;box-shadow:0 0 0 2px rgba(66,153,225,.15)}
.tag-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:#ebf8ff;color:#2b6cb0;border-radius:12px;font-size:12px;font-weight:500;white-space:nowrap}
.tag-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border-radius:50%;background:rgba(66,153,225,.2);color:#2b6cb0;font-size:11px;line-height:1;cursor:pointer;border:none;padding:0}
.tag-chip-remove:hover{background:#bee3f8}
.tag-input-field{flex:1;min-width:80px;border:none;outline:none;font-size:13px;color:#2d3748;background:transparent;padding:2px 0}
body.dark-mode .tag-input-wrap{background:#0f3460;border-color:#1a1a2e}
body.dark-mode .tag-chip{background:#1a365d;color:#90cdf4}
body.dark-mode .tag-chip-remove{background:rgba(144,205,244,.15);color:#90cdf4}
body.dark-mode .tag-input-field{color:#e0e0e0}

/* ── Tutorial content prose styles ─────────────────────────────────────────── */
.tut-content-body{line-height:1.8;font-size:14px;color:#2d3748;word-break:break-word}
.tut-content-body h1,.tut-content-body h2,.tut-content-body h3,.tut-content-body h4,.tut-content-body h5{font-weight:600;margin:1.2em 0 .5em;color:#1a202c;line-height:1.3}
.tut-content-body h1{font-size:1.5em;border-bottom:2px solid #e2e8f0;padding-bottom:.3em}
.tut-content-body h2{font-size:1.25em;border-bottom:1px solid #e2e8f0;padding-bottom:.2em}
.tut-content-body h3{font-size:1.1em}
.tut-content-body p{margin:.7em 0}
.tut-content-body ul,.tut-content-body ol{margin:.7em 0;padding-left:1.8em}
.tut-content-body li{margin:.3em 0}
.tut-content-body code{background:#f0f4f8;padding:2px 6px;border-radius:4px;font-family:monospace;font-size:13px;color:#c53030}
.tut-content-body pre{background:#f0f4f8;padding:12px 16px;border-radius:6px;overflow-x:auto;margin:.7em 0}
.tut-content-body pre code{background:none;padding:0;color:#2d3748;font-size:13px}
.tut-content-body blockquote{border-left:3px solid #a0aec0;margin:.7em 0;padding:.3em 1em;color:#718096;background:#f7fafc;border-radius:0 4px 4px 0}
.tut-content-body img{max-width:100%;border-radius:6px;margin:.5em 0;display:block}
.tut-content-body a{color:#4299e1;text-decoration:underline}
.tut-content-body hr{border:none;border-top:1px solid #e2e8f0;margin:1.2em 0}
.tut-content-body table{border-collapse:collapse;width:100%;margin:.7em 0;font-size:13px}
.tut-content-body th,.tut-content-body td{border:1px solid #e2e8f0;padding:6px 12px;text-align:left}
.tut-content-body th{background:#f7fafc;font-weight:600}
body.dark-mode .tut-content-body{color:#e0e0e0}
body.dark-mode .tut-content-body h1,body.dark-mode .tut-content-body h2,body.dark-mode .tut-content-body h3,body.dark-mode .tut-content-body h4{color:#e2e8f0;border-color:#2d3748}
body.dark-mode .tut-content-body code{background:#1a365d;color:#fc8181}
body.dark-mode .tut-content-body pre{background:#1a365d}
body.dark-mode .tut-content-body pre code{color:#e2e8f0}
body.dark-mode .tut-content-body blockquote{background:#1e2a3a;border-color:#4a5568;color:#a0aec0}
body.dark-mode .tut-content-body th{background:#1e2a3a}
body.dark-mode .tut-content-body th,body.dark-mode .tut-content-body td{border-color:#2d3748}
