/* 1Data — base style */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Nav */
.navbar { border-bottom: 1px solid var(--border); padding: 16px 0; }
.navbar .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 800; font-size: 1.4rem; text-decoration: none; color: var(--primary); }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); }

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #000;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dim); }
.btn-secondary {
    background: transparent;
    color: var(--text);
    padding: 8px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-decoration: none;
}
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-large { padding: 12px 32px; font-size: 1.1rem; }
button[type="submit"], .btn-submit {
    background: var(--primary); color:#000; border:none;
    padding:10px 24px; border-radius:6px;
    font-weight:600; cursor:pointer; font-size:.9rem;
    transition:opacity .15s;
}
button[type="submit"]:hover { opacity:.85; }

/* Hero */
.hero { padding: 100px 0 80px; text-align: center; }
.hero h1 { font-size: 3rem; font-weight: 800; margin-bottom: 16px; }
.hero .subtitle { font-size: 1.2rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 40px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; }

/* Features grid */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}
.card h3 { margin-bottom: 12px; color: var(--primary); }
.card p { color: var(--text-muted); font-size: 0.95rem; }

/* Footer */
footer { border-top: 1px solid var(--border); padding: 24px 0; margin-top: 80px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Login page */
.login-page { padding: 80px 0; display: flex; justify-content: center; }
.login-box { max-width: 420px; width: 100%; text-align: center; padding: 48px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; }
.login-box h1 { margin-bottom: 8px; }
.login-box .text-muted { margin-bottom: 32px; }
.btn-google {
    display: inline-flex; align-items: center; gap: 12px;
    background: #fff; color: #333; padding: 12px 28px;
    border-radius: var(--radius); font-weight: 600; font-size: 1rem;
    text-decoration: none; transition: all .2s;
}
.btn-google:hover { background: #f0f0f0; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* Node page */
.node-page { padding: 48px 0; }
.node-title { font-size: 2rem; margin-bottom: 24px; }
.node-content { line-height: 1.8; color: var(--text); }
.node-content h1, .node-content h2, .node-content h3, .node-content h4 { margin: 16px 0 8px; color: #e8c96a; }
.node-content h1 { font-size: 1.6rem; margin: 24px 0 12px; }
.node-content h2 { font-size: 1.3rem; margin: 32px 0 16px; border-bottom: 1px solid rgba(201,169,78,0.1); padding-bottom: 6px; }
.node-content h3 { font-size: 1.1rem; margin: 24px 0 12px; }
.node-content p { margin-bottom: 16px; color: var(--text-muted); }
.node-content strong { color: #e8c96a; }
.node-content blockquote strong { color: #e8c96a; }
.node-content li { margin-bottom: 8px; color: var(--text-muted); }
.node-content ul, .node-content ol { margin-bottom: 16px; padding-left: 24px; }
.node-content blockquote { border-left: 3px solid rgba(201,169,78,0.3); padding: 8px 14px; margin: 12px 0; color: #aaa; font-style: italic; background: rgba(201,169,78,0.04); }
.node-content code {
    background: rgba(201,169,78,0.08);
    color: #e8c96a;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: .85em;
}
.node-content pre {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,169,78,0.1);
    border-radius: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    margin: 12px 0;
}
.node-content pre code {
    background: none;
    color: #ddd;
    padding: 0;
    font-size: .82rem;
}
.node-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}
.node-content a { color: #c9a94e; text-decoration: underline; }
.node-content table { border-collapse: collapse; margin: 16px 0; width: 100%; }
.node-content th, .node-content td { border: 1px solid rgba(255,255,255,0.08); padding: 8px 12px; text-align: left; }
.node-content th { background: rgba(201,169,78,0.08); color: #e8c96a; font-weight: 600; }

/* Error */
.error-page { text-align: center; padding: 100px 0; }
.error-page h1 { font-size: 5rem; color: var(--primary); }
.error-page a { color: var(--primary); }

/* === Dashboard & Sidebar Theme (layout override) === */
.page-content {
    max-width:800px; width:100%;
    margin:0 auto; padding:32px 24px;
}
.page-content h1 { font-size:1.5rem; margin-bottom:16px; }
.page-content h2 { font-size:1.2rem; margin:20px 0 10px; }

/* Form styles */
.form-doflow { margin:16px 0; }
.flow-form { margin-bottom:12px; }
.flow-form input[type="text"],
.flow-form textarea,
.flow-form input[type="url"] {
    width:100%; padding:10px 12px;
    background:var(--card-bg); color:var(--text);
    border:1px solid var(--border); border-radius:8px;
    font-family:inherit; font-size:.95rem;
    outline:none; transition:border-color .15s;
}
.flow-form textarea { resize:vertical; min-height:80px; }
.flow-form input:focus, .flow-form textarea:focus { border-color:var(--primary); }
.flow-form label { display:flex; align-items:center; gap:8px; font-size:.9rem; color:var(--text-muted); cursor:pointer; }

/* Dashboard charts */
.qb{display:flex;align-items:center;margin-bottom:6px;gap:8px}
.ql{width:70px;font-size:.78rem;color:var(--text-muted);text-align:right}
.qt{flex:1;height:16px;background:#1a1a28;border-radius:4px;overflow:hidden}
.qf{height:100%;border-radius:4px;transition:width .3s}
.qv{width:26px;text-align:right;font-size:.78rem;font-weight:600}
.fill-good{background:#00e5a0}.fill-mid{background:#f0ad4e}.fill-bad{background:#e74c3c}
.dg{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.dc{background:var(--card-bg);border:1px solid var(--border);border-radius:var(--radius);padding:24px}
.dc h3{font-size:1rem;margin-bottom:12px}
.dff{grid-column:1/-1}
.fi{padding:8px;border-left:2px solid var(--primary-dim);margin-bottom:4px}
.fa{font-size:.88rem;font-weight:600}.fm{font-size:.76rem;color:var(--text-muted)}
.txm{font-size:.85rem;color:var(--text-muted)}
.btn-o{display:inline-block;padding:6px 14px;border:1px solid var(--primary);border-radius:6px;color:var(--primary);text-decoration:none;font-size:.85rem;margin-top:8px}
.btn-o:hover{background:var(--primary);color:#000}

/* Thinking / Soul form */
.form-group{margin-bottom:14px}
.form-group label{display:block;font-size:.85rem;color:var(--text-muted);margin-bottom:4px}
.form-input{width:100%;padding:10px 12px;background:var(--card-bg);border:1px solid var(--border);border-radius:6px;color:var(--text);font-size:.9rem;outline:none;transition:border-color .2s;box-sizing:border-box}
.form-input:focus{border-color:var(--primary)}
.form-textarea{min-height:80px;resize:vertical}
.form-msg{margin-top:8px;font-size:.85rem}
.form-msg.ok{color:var(--primary)}

/* Group styles */
.group-list {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
    gap:16px;
    margin-top:20px;
}
.group-card {
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:10px;
    padding:16px;
    transition:border-color 0.2s,box-shadow 0.2s;
}
.group-card:hover {
    border-color:var(--primary);
    box-shadow:0 2px 12px rgba(0,0,0,0.15);
}
.group-info {
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:6px;
}
.group-name {
    font-weight:600;
    font-size:.95rem;
    text-decoration:none;
    color:var(--text);
}
.group-name:hover {
    color:var(--primary);
}
.group-role {
    font-size:.75rem;
    background:#2a2a3a;
    color:var(--text-muted);
    padding:2px 8px;
    border-radius:10px;
}
.group-public {
    font-size:.75rem;
    background:#0a3a1a;
    color:var(--primary-dim);
    padding:2px 8px;
    border-radius:10px;
}
.group-count {
    font-size:.8rem;
    color:var(--text-muted);
    margin-right:10px;
}
.group-owner {
    font-size:.8rem;
    color:var(--text-muted);
}
.group-tags {
    margin-top:10px;
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}
.group-tags .tag {
    font-size:.72rem;
    color:var(--primary);
    background:rgba(0,212,170,0.08);
    padding:3px 10px;
    border-radius:12px;
    border:1px solid rgba(0,212,170,0.2);
    transition:background 0.15s;
}
.group-tags .tag:hover {
    background:rgba(0,212,170,0.15);
}

/* Group render */
.group-header { margin-bottom: 20px; }
.group-header h1 { margin: 0 0 8px 0; }
.group-desc { color: var(--text-muted); }
.group-meta { display: flex; gap: 16px; font-size: 0.85em; color: var(--text-muted); }
.msg-info { background: #0a1a2a; border: 1px solid #1a3a5a; padding: 10px; border-radius: 8px; margin: 12px 0; color: var(--text); }
.msg-success { background: #0a2a1a; border: 1px solid #0a4a2a; padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.msg-error { background: #2a0a0a; border: 1px solid #4a1a1a; padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.group-members { margin: 16px 0; }
.member-list { display: flex; flex-direction: column; gap: 4px; }
.member-card { padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.member-name { font-weight: 500; }
.member-role { font-size: 0.8em; background: #2a2a3a; padding: 2px 8px; border-radius: 10px; }
.kick-btn { font-size: 0.75em; padding: 2px 8px; background: #4a1a1a; color: var(--text); border: none; border-radius: 4px; cursor: pointer; }
.group-flows { margin-top: 16px; }
.flow-list { margin-top: 8px; }
.flow-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.flow-meta { display: flex; justify-content: space-between; font-size: 0.85em; margin-bottom: 4px; }
.flow-content { color: var(--text); }
.flow-time { color: var(--text-muted); }
.section-title { font-size:1rem; margin:16px 0 8px; }

/* Flow pages (doflow, thinking list) */
.flow-row{padding:12px;border:1px solid var(--border);border-radius:8px;margin-bottom:8px;background:var(--card-bg)}
.flow-title{font-size:.88rem;font-weight:500;line-height:1.5}
.flow-meta{font-size:.76rem;color:var(--text-muted);margin-top:4px}

/* Reports */
.ri{padding:8px;border:1px solid var(--border);border-radius:6px;margin-bottom:4px}
.rt{font-size:.88rem;font-weight:600}.rd{font-size:.76rem;color:var(--text-muted)}

/* Responsive */
@media (max-width: 768px) {
    .grid-3 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .page-content { padding:16px 12px; }
    .dg { grid-template-columns:1fr; }
}

/* Upload button */
.upload-btn {
    display:inline-block;
    padding:10px 18px;
    background:var(--card-bg);
    color:var(--text);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
    font-size:.9rem;
    transition:border-color .2s;
}
.upload-btn:hover { border-color:var(--primary); }

/* Flow stream rows */
.fl-row{display:flex;gap:8px;padding:8px;border-bottom:1px solid var(--border)}
.fl-tag{font-size:1rem;min-width:20px}
.fl-body{flex:1}
.fl-action{font-size:.88rem;font-weight:500}
.fl-meta{display:flex;gap:12px;font-size:.76rem;color:var(--text-muted)}
.fl-time{color:var(--text-muted)}

/* Group: compact members */
.group-members-compact { padding:4px 0 12px; display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.member-count { font-size:.8rem; color:var(--text-muted); margin-right:4px; }
.member-chip { font-size:.8rem; background:rgba(12,12,14,0.65); padding:3px 10px; border-radius:12px; color:var(--text-muted); }

/* Group: flow list */
.group-flows { padding-bottom:100px; }
.group-flows .flow-item {border-bottom: 1px solid #c9a94e3b; border: 1px solid rgba(201, 169, 78, 0.3); padding: 10px;border-radius: 15px;    margin-top: 10px;}
.group-flows .flow-item:last-child { border-bottom:none; }
.group-flows .flow-meta { display:flex; gap:8px; align-items:center; margin-bottom:4px; font-size:.85rem; }

/* Author avatar trong flow */
.flow-author-avatar { display:inline-flex; flex-shrink:0; }
.flow-author-avatar img { width:24px; height:24px; border-radius:50%; object-fit:cover; }
.flow-author-avatar.sm img { width:20px; height:20px; }
.flow-meta .flow-author-avatar + a { text-decoration:none; color:var(--text); }
.flow-meta .flow-author-avatar + a:hover { text-decoration:underline; }
.reply-item .flow-author-avatar.sm + a { text-decoration:none; color:var(--text); }
.reply-item .flow-author-avatar.sm + a:hover { text-decoration:underline; }
.group-flows .flow-time { color:var(--text-muted); font-size:.8rem; }
.group-flows .flow-content { font-size:.9rem; line-height:1.5; }

/* Group: action type selector (Gemini-style dropdown) */
.group-tools-left,
.group-tools-right { display:flex; align-items:center; gap:8px; }
.group-action-select {
    position:relative;
    display:inline-flex; align-items:center; gap:4px;
    padding:6px 12px; border-radius:18px;
    font-size:.82rem; cursor:pointer; user-select:none;
    background:rgba(12,12,14,0.65); color:var(--text-muted);
    border:1px solid var(--border); transition:all .15s;
}
.group-action-select:hover { border-color:var(--primary); color:var(--text); }
/* Markdown mini buttons */
.md-btn {
    width:26px; height:26px;
    display:flex; align-items:center; justify-content:center;
    background:transparent; border:1px solid var(--border); border-radius:4px;
    color:var(--text-muted); cursor:pointer; font-size:.72rem;
    font-weight:600; transition:all .1s;
}
.md-btn:hover { color:var(--text); border-color:var(--primary); }
.action-arrow { font-size:.6rem; margin-left:2px; opacity:.6; }
.action-dropdown {
    display:none; position:absolute; bottom:calc(100% + 8px); left:0;
    background:rgba(12,12,14,0.65); border:1px solid var(--border); border-radius:12px;
    padding:4px; z-index:200; min-width:180px;
    box-shadow:0 4px 16px rgba(0,0,0,.3);
}
.action-dropdown.show { display:block; }
.action-option {
    display:flex; align-items:center; gap:6px;
    padding:8px 12px; border-radius:8px; cursor:pointer;
    font-size:.82rem; color:var(--text); transition:background .1s;
}
.action-option:hover { background:var(--border); }
.action-option.active { background:var(--primary); color:#000; font-weight:600; }
.group-input-tools {display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0px 10px 10px 10px;
    box-sizing: border-box;}
/* Group: fixed input bar */
.group-input-bar {
    position:fixed; bottom:0; left:220px; right:0px;
    background:none;
    border-top:0px solid var(--border);
    padding:8px 16px 12px;
    z-index:100;
}
.sidebar.collapsed ~ .main .group-input-bar,
body:has(.sidebar.collapsed) .group-input-bar { left:56px; }
.group-input-form { max-width:768px; margin:0 auto; border: 1px solid #343131; border-radius: 15px;background: #0f0f19;}
.group-input-row { display:flex; gap:8px; align-items:flex-end; }
.group-input-wrap { position:relative; flex:1; }
.group-input {
    width:100%;
    padding:14px 44px 14px 18px;
    background:rgba(12,12,14,0.65); color:var(--text);
    border:1px solid var(--border); border-radius:24px;
    font-family:inherit; font-size:.95rem;
    resize:none;
    outline:none;
    min-height:52px; max-height:200px;
    line-height:1.5;
    overflow-y:auto;
    scrollbar-width:thin;
    scrollbar-color:var(--border) transparent;
    box-shadow:0 1px 3px rgba(0,0,0,.08);
    transition:border-color .2s, box-shadow .2s;
    border: none;
    background: #0f0f19;

}
.group-input::-webkit-scrollbar { width:4px; }
.group-input::-webkit-scrollbar-track { background:transparent; }
.group-input::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
.group-input:focus { border-color:var(--primary); box-shadow:0 1px 8px rgba(0,229,160,.15); outline: none;box-shadow: none;}
/* Expanded mode — full textarea */
.group-input.expanded { min-height:50vh; max-height:70vh; border-radius:12px; scrollbar-width:auto; }
.group-input.expanded::-webkit-scrollbar { width:6px; }
.group-input.expanded::-webkit-scrollbar-thumb { background:var(--text-muted); border-radius:3px; }

.group-attach {
    display:flex; align-items:center; justify-content:center;
    width:40px; height:40px; border-radius:50%;
    background:rgba(12,12,14,0.65);
    cursor:pointer; font-size:1.1rem; flex-shrink:0;
    transition:background .15s;
    border:1px solid var(--border);
}
.group-attach:hover { background:var(--border); }
.group-send {
    background:var(--primary); color:#000; border:none;
    width:40px; height:40px; border-radius:50%;
    font-weight:600; cursor:pointer; font-size:1.1rem;
    flex-shrink:0; display:flex; align-items:center; justify-content:center;
    padding:0;
    transition:opacity .15s;
}
.group-send:hover { opacity:.85; }
.group-file-name { font-size:.8rem; color:var(--text-muted); padding:2px 0; }
.group-expand-btn {
    display:flex; align-items:center; justify-content:center;
    width:32px; height:32px;
    border:1px solid var(--border); background:rgba(12,12,14,0.65);
    color:var(--text-muted); cursor:pointer;
    font-size:.85rem; border-radius:50%;
    opacity:.6; flex-shrink:0;
    transition:opacity .15s,background .15s;
}
.group-expand-btn:hover { opacity:1; background:var(--border); }

/* Mobile: input bar left padding */
@media (max-width:768px) {
    .group-input-bar { left:0; padding-bottom:calc(12px + env(safe-area-inset-bottom,0px)); }
    .group-flows { padding-bottom:80px; }
}

/* Flow metadata chips (files, links) */
.flow-meta-attach { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; align-items:start; }
.file-thumb { max-width:160px; max-height:120px; border-radius:6px; object-fit:cover; border:1px solid var(--border,#ddd); cursor:pointer; transition:transform .15s; }
.file-thumb:hover { transform:scale(1.05); }
.meta-img-wrap { display:inline-block; line-height:0; }
.meta-chip { font-size:.75rem; background:rgba(12,12,14,0.65); padding:2px 8px; border-radius:4px; color:var(--text-muted); max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-decoration:none; display:inline-block; }
a.meta-chip { color:var(--link-color,#2980b9); cursor:pointer; }
a.meta-chip:hover { background:var(--hover-bg,#eee); text-decoration:underline; }
.group-expand-btn:hover { opacity:1; background:rgba(12,12,14,0.65); color:var(--text); }


/* New flow highlight — persists until reload */
.new-flow { background:rgba(255,50,50,.4) !important; border-left:4px solid #ff4444 !important;}

/* Read More button — inline expand in flow list */
.read-more-btn {
    background:rgba(12,12,14,0.65); border:1px solid var(--border); border-radius:6px;
    color:var(--accent); cursor:pointer;
    font-size:.8rem; padding:6px 12px; display:block; margin-top:4px;
    transition:background .15s, border-color .15s;
}
.read-more-btn:hover { background:var(--hover-bg,rgba(99,102,241,0.08)); border-color:var(--accent); text-decoration:underline; }
.flow-content-full {
    margin-top:4px; padding:8px; background:rgba(12,12,14,0.65); border-radius:6px;
    font-size:.85rem; line-height:1.6; white-space:pre-wrap; word-break:break-word;
    max-height:400px; overflow-y:auto;
}

/* === AUTOSEO Config === */
.autoseo-page { max-width:700px; margin:0 auto; padding:20px; }
.autoseo-form .form-group { margin-bottom:16px; }
.autoseo-form label { display:block; font-weight:600; margin-bottom:4px; color:var(--text); }
.autoseo-form input, .autoseo-form select, .autoseo-form textarea {
    width:100%; padding:8px 12px; border:1px solid #ddd; border-radius:6px;
    font-size:14px; background:#fff; box-sizing:border-box;
}
.autoseo-form textarea { resize:vertical; min-height:60px; }
.autoseo-form .form-hint { font-size:12px; color:green; margin-left:8px; }
.autoseo-form .btn {
    background:var(--accent); color:#fff; border:none; padding:10px 24px;
    border-radius:6px; cursor:pointer; font-size:15px; font-weight:600;
}
.autoseo-form .btn:hover { opacity:.85; }

/* Radio group */
.radio-group { display:flex; gap:20px; padding:4px 0; flex-wrap:wrap; }
.radio-label { display:inline-flex !important; align-items:center; gap:6px; cursor:pointer; font-size:15px; width:auto; }
.radio-label input[type="radio"] { width:16px; height:16px; accent-color:var(--primary); }
.autoseo-status {
    margin-top:24px; padding:16px; background:#f0fdf4; border-radius:8px;
    border:1px solid #86efac;
}
.autoseo-status h3 { margin:0 0 8px 0; color:#166534; }
.msg-success {
    padding:10px 16px; background:#dcfce7; border:1px solid #86efac;
    border-radius:6px; margin-bottom:16px; color:#166534;
}

/* Sidebar section label */
.sidebar-divider { border:none; border-top:1px solid var(--border); margin:8px 12px; opacity:0.4; }
.sidebar-section-label {
    padding:6px 16px 2px; font-size:0.75rem; color:var(--text-muted);
    text-transform:uppercase; letter-spacing:0.5px; font-weight:600;
}

/* Sidebar section label */
.sidebar-divider { border:none; border-top:1px solid var(--border); margin:8px 12px; opacity:0.4; }
.sidebar-section-label {
    padding:6px 16px 2px; font-size:0.75rem; color:var(--text-muted);
    text-transform:uppercase; letter-spacing:0.5px; font-weight:600;
}

/* Sidebar section head — like Dashboard/Do Flow */
.sidebar-section-head {
    display:flex !important; align-items:center; gap:10px;
    padding:10px 16px; font-size:14px; font-weight:500;
    color:var(--text); cursor:default;
}
/* Sidebar sub menu — smaller, indented */
.sidebar-sub {
    display:flex !important; align-items:center;
    padding:6px 16px 6px 44px !important; font-size:13px;
    color:var(--text-muted); 
}
.sidebar-sub:hover { color:var(--text); }
.sidebar a.active { color:var(--primary); font-weight:600; background:var(--primary-light,rgba(99,102,241,0.06)); }
.sidebar-sub.active { color:var(--primary); }

/* === Group Reply + Reaction — hover mới hiện === */
.flow-item { position:relative; }
.flow-reactions { display:none; gap:4px; flex-wrap:wrap; margin:6px 0 4px; }
/* Reactions trong flow-meta — luôn hiện, nhỏ gọn */
.flow-meta .flow-reactions { display:inline-flex; gap:2px; align-items:center; margin-left:auto; }
.flow-meta .flow-reactions:empty { display:none; }
.react-btn { display:inline-flex; align-items:center; gap:2px; padding:0 5px; border:1px solid var(--border); border-radius:8px; background:var(--bg); cursor:pointer; font-size:.7rem; line-height:1.5; height:20px; }
.react-add { padding:0 4px; font-size:.7rem; }
.flow-meta .react-add { display:inline-flex; }
.react-btn:hover { border-color:var(--primary); }
.react-btn.active { background:var(--primary-light,rgba(99,102,241,0.1)); border-color:var(--primary); }
.react-btn .cnt { font-size:.65rem; color:var(--text-muted); margin-left:1px; }
.react-add { border-style:dashed; color:var(--text-muted); padding:0 4px; font-size:.7rem; }
.react-picker { display:flex; gap:2px; padding:4px; background:var(--bg); border:1px solid var(--border); border-radius:8px; box-shadow:0 2px 8px rgba(0,0,0,0.15); z-index:100; }
.react-picker button { background:none; border:none; font-size:1.3rem; cursor:pointer; padding:2px 4px; border-radius:4px; }
.react-picker button:hover { background:var(--hover-bg,#f0f0f0); transform:scale(1.2); }
.reply-badge { font-size:.75rem; color:var(--text-muted); margin-left:auto; cursor:pointer; padding:0 4px; border-radius:4px; }
.reply-badge:hover { color:var(--primary); background:var(--primary-light,rgba(99,102,241,0.08)); }

/* Replies — luôn hiển thị */
.flow-replies { margin:2px 0 4px 20px; padding:4px 8px; border-left:2px solid var(--border); background:var(--bg-secondary,transparent); border-radius:0 4px 4px 0; }
.reply-item { font-size:.85rem; padding:2px 0; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.reply-item strong { font-size:.8rem; }
.reply-text { color:var(--text); word-break:break-word; }
.reply-item .flow-time { font-size:.7rem; margin-left:auto; white-space:nowrap; }
.reply-item.new-reply { animation:fadeIn 0.3s; }
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

/* Reply form */
.reply-form { display:none; margin-left:20px; margin-bottom:4px; }
.reply-form.open { display:flex; }
.reply-input { width:100%; padding:6px 10px; border:1px solid var(--border); border-radius:6px; font-size:.85rem; background:var(--bg); color:var(--text); }

/* Reply form — hover mới hiện nữa, hoặc nếu đang mở */

.new-flow { animation:fadeIn 0.5s; border-radius: 10px;}

/* Group tags */
.group-tags { margin-top:6px; display:flex; flex-wrap:wrap; gap:4px; }
.group-tags .tag { font-size:.7rem; color:var(--primary); background:rgba(0,212,170,0.08); padding:2px 8px; border-radius:10px; border:1px solid rgba(0,212,170,0.15); }

/* Pagination */
.pagination { display:flex; gap:6px; justify-content:center; margin:24px 0; flex-wrap:wrap; }
.pagination .page-link { padding:6px 14px; border-radius:6px; text-decoration:none; color:var(--text-muted); font-size:.85rem; border:1px solid var(--border); transition:all .15s; }
.pagination .page-link:hover { background:rgba(12,12,14,0.65); color:var(--text); }
.pagination .page-link.active { background:var(--primary); color:#000; font-weight:600; border-color:var(--primary); }

/* === Entity Page === */
.entity-page { max-width:720px; margin:0 auto; padding:24px 16px; }
.entity-hero { display:flex; gap:20px; align-items:center; margin-bottom:28px; }
.entity-hero-avatar { width:88px; height:88px; border-radius:50%; object-fit:cover; border:3px solid var(--primary); flex-shrink:0; }
.entity-hero-avatar-placeholder { display:flex; align-items:center; justify-content:center; background:var(--primary); color:#000; font-size:2rem; font-weight:700; }
.entity-hero-info { min-width:0; }
.entity-hero-name { margin:0 0 4px 0; font-size:1.5rem; font-weight:700; }
.entity-hero-meta { display:flex; gap:10px; align-items:center; font-size:.85rem; flex-wrap:wrap; }
.entity-hero-slug { color:var(--text-dim); font-family:monospace; }
.entity-hero-type { display:inline-block; padding:2px 10px; border-radius:12px; background:rgba(12,12,14,0.65); color:var(--text-muted); font-size:.78rem; }
.entity-section { margin-bottom:24px; }
.entity-section-title { font-size:1rem; font-weight:600; margin:0 0 12px 0; color:var(--text); }
.entity-bio { line-height:1.7; }
.entity-bio .node-content p:first-child { margin-top:0; }
.wp-chip-list { display:flex; flex-wrap:wrap; gap:8px; }
.wp-chip { display:inline-flex; align-items:center; gap:6px; padding:4px 12px 4px 4px; border-radius:20px; background:rgba(12,12,14,0.65); border:1px solid var(--border); text-decoration:none; color:var(--text); font-size:.85rem; transition:all .15s; }
.wp-chip:hover { border-color:var(--primary); background:var(--card-bg); }
.wp-mini-avatar { width:24px; height:24px; border-radius:50%; object-fit:cover; flex-shrink:0; }
.wp-avatar-placeholder { display:flex; align-items:center; justify-content:center; background:var(--primary); color:#000; font-size:.7rem; font-weight:600; }

/* Entity hero actions */
.entity-hero-actions { display:flex; gap:10px; align-items:center; margin-top:8px; flex-wrap:wrap; }
.entity-follow-btn { display:inline-flex; align-items:center; gap:4px; padding:6px 16px; border-radius:20px; font-size:.82rem; font-weight:500; cursor:pointer; border:1px solid var(--primary); background:var(--primary); color:#000; transition:all .15s; text-decoration:none; }
.entity-follow-btn:hover { opacity:.85; }
.entity-follow-btn.following { background:transparent; color:var(--text); border-color:var(--border); }
.entity-follower-count { font-size:.82rem; color:var(--text-dim); }
.entity-hero-stats { display:flex; gap:8px; align-items:center; margin-top:4px; flex-wrap:wrap; }
.entity-trust-point { display:inline-flex; align-items:center; gap:3px; padding:2px 10px; border-radius:12px; background:linear-gradient(135deg,#f6d365,#fda085); color:#000; font-size:.78rem; font-weight:600; }
/* Post list styles already exist from node_render */
.member-ai-btn { background:none; border:1px solid var(--accent); color:var(--accent); cursor:pointer; padding:2px 6px; margin-left:8px; border-radius:4px; font-size:14px; transition:all 0.2s; vertical-align:middle; }
.member-ai-btn:hover { background:var(--accent); color:white; }
.energy-bar-wrap { display:inline-block; position:relative; width:120px; height:18px; background:var(--border); border-radius:9px; overflow:hidden; vertical-align:middle; }
.energy-bar { position:absolute; left:0; top:0; height:100%; background:linear-gradient(90deg,#4ade80,#22c55e,#16a34a); border-radius:9px; transition:width 0.5s; min-width:4px; }
.energy-label { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); font-size:10px; color:white; font-weight:600; white-space:nowrap; text-shadow:0 1px 2px rgba(0,0,0,0.5); pointer-events:none; }
.td-center { text-align:center; font-weight:600; font-size:14px; }
.td-activity { font-size:13px; color:var(--text-secondary); }
.member-name-text a { color:inherit; text-decoration:none; }
.member-name-text a:hover { color:var(--accent); text-decoration:underline; }
.group-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.group-tab {
    padding: 8px 5px;
    cursor: pointer;
    background: none;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    font-size: .9rem;
    transition: color .15s, border-color .15s;
    text-decoration: none;
}
.group-tab:hover {
    color: var(--text);
}
.group-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}
/* Members table */
.member-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.member-table th,
.member-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.member-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.member-table tr:hover td {
    background: rgba(255,255,255,.03);
}
.member-avatar {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-dim);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 600;
    margin-right: 8px;
    flex-shrink: 0;
}
.member-name-cell {
    display: flex;
    align-items: center;
}
.badge-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 500;
}
.badge-role.admin { background: rgba(0,229,160,.15); color: var(--primary); }
.badge-role.member { background: rgba(255,255,255,.08); color: var(--text-muted); }
.badge-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: .75rem;
}
.badge-status.active { background: rgba(0,229,160,.12); color: var(--primary); }
.badge-status.invited { background: rgba(255,193,7,.15); color: #ffc107; }
.badge-status.banned { background: rgba(244,67,54,.15); color: #f44336; }
.action-btn {
    padding: 4px 10px;
    font-size: .75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 4px;
    transition: opacity .15s;
}
.action-btn:hover { opacity: .8; }
.action-btn.approve { background: var(--primary-dim); color: #fff; }
.action-btn.reject { background: #d32f2f; color: #fff; }
.action-btn.ban { background: #e65100; color: #fff; }
.action-btn.unban { background: #388e3c; color: #fff; }

/* Mindset tab */
.mindset-panel {
    background:var(--card-bg); border:1px solid var(--border);
    border-radius:12px; padding:20px; margin-bottom:16px;
}
.mindset-panel h3 { margin:0 0 12px 0; font-size:1.1rem; }
.mindset-stat {
    text-align:center; padding:8px 16px;
    background:rgba(12,12,14,0.65); border-radius:8px;
    min-width:80px;
}
.stat-num { font-size:1.5rem; font-weight:700; color:var(--primary); display:block; }
.stat-label { font-size:.75rem; color:var(--text-muted); }
.chart-bar-item:hover { opacity:.85; transform:scaleY(1.05); }

/* Heatmap */
.heatmap-table { border-collapse:collapse; font-size:.82rem; width:100%; }
.heatmap-table th {
    padding:6px 10px; text-align:center; font-weight:500;
    color:var(--text-muted); border-bottom:1px solid var(--border);
    font-size:.75rem; white-space:nowrap;
}
.heatmap-table td { padding:6px 10px; text-align:center; }
.heatmap-name { text-align:left!important; font-weight:500; white-space:nowrap; }
.heatmap-cell {
    border-radius:6px; font-weight:500; min-width:36px;
    font-size:.78rem;
}
.heatmap-total { font-weight:700; color:var(--text-muted); }
.mindset-insight {
    background:rgba(12,12,14,0.65); border-radius:8px; padding:14px 18px;
    font-size:.9rem; line-height:1.7; max-height:400px; overflow-y:auto;
}

/* Pin button */
.pin-btn {
    cursor: pointer;
    font-size: .9rem;
    opacity: .5;
    margin-left: 8px;
    transition: opacity .15s;
    display: inline-flex;
    align-items: center;
}
.pin-btn:hover {
    opacity: 1;
}
/* Flow tag button */
.flow-tag-btn {
    cursor: pointer;
    font-size: .9rem;
    opacity: .5;
    margin-left: 8px;
    transition: opacity .15s;
    display: inline-flex;
    align-items: center;
    position: relative;
}
.flow-tag-btn:hover {
    opacity: 1;
}
.flow-item.pinned-item {
    background: rgba(0,229,160,.07);
    border: 1px solid rgba(0,229,160,.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}
.flow-item.pinned-item .flow-content.pinned {
    border-left: 3px solid var(--primary);
    padding-left: 10px;
    font-weight: 600;
}
.pin-indicator {
    color: var(--primary);
    font-size: .75rem;
    font-weight: 600;
    margin-right: 8px;
}
.pinned-separator {
    text-align: center;
    color: var(--text-muted);
    font-size: .75rem;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 12px;
}

/* ===== MOBILE — max-width 640px ===== */
@media (max-width: 640px) {
    /* Header: prevent title overlap */
    .group-header h1 {
        font-size: 1.1rem;
        max-width: calc(100% - 90px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Tab bar: scrollable */
    .group-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 2px;
        padding-bottom: 4px;
    }
    .group-tab {
        white-space: nowrap;
        font-size: .78rem;
        padding: 6px 10px;
        flex-shrink: 0;
    }
    .group-tab-right { flex-shrink: 0; }

    /* Action chips */
    .group-chips {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 4px;
        padding-bottom: 2px;
    }
    .group-chip {
        font-size: .75rem;
        padding: 3px 8px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Datafiles table: horizontal scroll + compact */
    #df-file-list table,
    #df-search-results table {
        font-size: .72rem;
    }
    #df-file-list th,
    #df-search-results th,
    #df-file-list td,
    #df-search-results td {
        padding: 4px 4px;
    }
    /* Hide less critical columns on mobile */
    #df-file-list th:nth-child(2),
    #df-file-list td:nth-child(2),
    #df-file-list th:nth-child(4),
    #df-file-list td:nth-child(4),
    #df-search-results th:nth-child(3),
    #df-search-results td:nth-child(3) {
        display: none;
    }

    /* Dropzone */
    #df-dropzone {
        padding: 10px;
        font-size: .82rem;
    }
    #df-dropzone div:last-child {
        font-size: .75rem;
    }

    /* Flow items */
    .flow-item {
        padding: 8px 0;
    }
    .flow-meta {
        flex-wrap: wrap;
        gap: 4px;
    }
    .flow-content {
        font-size: .85rem;
    }
    .reply-badge {
        margin-left: 4px;
    }

    /* Flow search inline */
    #flow-inline-search {
        margin-bottom: 6px;
    }
    #flow-inline-input {
        font-size: .85rem;
        padding: 8px 12px;
    }
    #flow-inline-results .search-item {
        padding: 8px 10px;
    }

    /* Datafiles search input */
    #df-search-input {
        font-size: .85rem;
        padding: 8px 12px;
    }

    /* Flow input bar */
    .group-input-bar {
        padding: 10px;
        gap: 6px;
    }
    .group-input-bar button {
        white-space: nowrap;
        padding: 6px 10px;
        font-size: .78rem;
    }

    /* Members table: stack as cards */
    .member-table table,
    .member-table thead,
    .member-table tbody,
    .member-table th,
    .member-table td,
    .member-table tr {
        display: block;
    }
    .member-table thead { display: none; }
    .member-table tr {
        margin-bottom: 10px;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 8px 10px;
        background: var(--surface);
    }
    .member-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        border: none;
        font-size: .82rem;
    }
    .member-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: .72rem;
        margin-right: 8px;
        flex-shrink: 0;
    }
    /* nth-child fallback when no data-label attribute */
    .member-table td:nth-child(1)::before { content: "Thành viên"; }
    .member-table td:nth-child(2)::before { content: "Vai trò"; }
    .member-table td:nth-child(3)::before { content: "Hoạt động"; }
    .member-table td:nth-child(4)::before { content: "Trạng thái"; }
    .member-table td:nth-child(5)::before { content: "Thao tác"; }
    .badge-role, .badge-status {
        font-size: .7rem;
    }

    /* Reply form */
    .reply-input {
        font-size: .82rem;
    }

    /* Page padding */
    #body_id, .page-content {
        padding: 10px 8px;
    }
}

/* === Workspace: Search loading animation === */
.search-loading { position: relative; }
.search-loading::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 26px;
    border: 2px solid var(--accent);
    animation: searchPulse 1.2s ease-in-out infinite;
    pointer-events: none;
}
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn-loading::after {
    content: '';
    position: absolute;
    inset: 50% 0 0 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: btnSpin .7s linear infinite;
}
.btn-loading-dots::after {
    content: '';
    display: inline-block;
    width: 8px;
    animation: dotsAnim 1.4s steps(4) infinite;
}
@keyframes searchPulse {
    0%, 100% { opacity: .3; transform: scale(1); }
    50% { opacity: .8; transform: scale(1.02); }
}
@keyframes btnSpin {
    to { transform: translate(-50%,-50%) rotate(360deg); }
}
@keyframes dotsAnim {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* === Workspace: Soul chips === */
.soul-chip {
    display:inline-block; padding:4px 12px; border-radius:16px;
    font-size:.82rem; cursor:pointer; user-select:none;
    background:rgba(12,12,14,0.65); color:var(--text-muted);
    border:1px solid var(--border); transition:all .15s;
}
.soul-chip:hover { border-color:var(--primary); color:var(--text); }
.soul-chip.active { background:var(--primary); color:#000; border-color:var(--primary); font-weight:600; }

/* === Workspace: AI Chat === */
.chat-messages {
    height:450px; overflow-y:auto; padding:16px;
    display:flex; flex-direction:column; gap:8px;
    scrollbar-width:thin; scrollbar-color:var(--text-muted) transparent;
}
.chat-messages::-webkit-scrollbar { width:4px; }
.chat-messages::-webkit-scrollbar-track { background:transparent; }
.chat-messages::-webkit-scrollbar-thumb { background:var(--text-muted); border-radius:2px; }
.chat-empty { color:var(--text-muted); text-align:center; padding:40px 16px; font-size:.9rem; }
.chat-msg {
    max-width:80%; padding:8px 14px; border-radius:16px;
    font-size:.88rem; line-height:1.4; word-wrap:break-word;
}
.chat-msg.incoming { align-self:flex-start; background:var(--bg); border:1px solid var(--border); }
.chat-msg.outgoing { align-self:flex-end; background:var(--primary); color:#000; }
.chat-msg .chat-meta { font-size:.65rem; margin-top:4px; opacity:.7; }
.chat-input-row { display:flex; gap:8px; align-items:center; padding:12px 16px; border-top:1px solid var(--border); background:var(--sidebar); }
.chat-input { flex:1; padding:10px 14px; border-radius:20px; border:1px solid var(--border); background:var(--bg); color:var(--text); font-family:inherit; font-size:.9rem; outline:none; resize:none; min-height:20px; max-height:120px; transition:border-color .15s; }
.chat-input:focus { border-color:var(--primary); }
.chat-send-btn { width:36px; height:36px; border-radius:50%; border:none; background:var(--primary); color:#000; font-size:1rem; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:opacity .15s; }
.chat-send-btn:hover { opacity:.85; }
.chat-send-btn.thinking {
    animation: rainbow-spin 1.5s linear infinite;
    pointer-events: none;
    position: relative;
    background: conic-gradient(#ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000);
}
.chat-send-btn.thinking::after {
    content: '⏳';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--bg-card, #1a1a2e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    animation: rainbow-spin-reverse 1.5s linear infinite;
}
@keyframes rainbow-spin {
    0% { transform: rotate(0deg); filter: hue-rotate(0deg); }
    100% { transform: rotate(360deg); filter: hue-rotate(360deg); }
}
@keyframes rainbow-spin-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}
.chat-msg-loading .loading-dots span { animation: blink 1.4s infinite both; }
.chat-msg-loading .loading-dots span:nth-child(2) { animation-delay: .2s; }
.chat-msg-loading .loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0% { opacity: .2; } 20% { opacity: 1; } 100% { opacity: .2; } }
.chat-msg.incoming pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 6px 0; overflow-x: auto; }
.chat-msg.incoming pre code { font-family: 'Consolas','Monaco','Courier New',monospace; font-size: .8rem; line-height: 1.3; }
.chat-msg.incoming p code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: .82rem; }

/* ✨ Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #c9a94e, #e8c96a, #d4a843);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ✨ Glass card */
.card-glass {
    background: var(--card-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: box-shadow .3s, transform .2s;
}
.card-glass:hover {
    box-shadow: 0 0 40px rgba(201,169,78,0.08);
    transform: translateY(-1px);
}

/* ✨ Gradient border */
.gradient-border {
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, #c9a94e, #e8c96a) 1;
    border-radius: var(--radius-lg);
}

/* ✨ Glow button */
.btn-glow {
    background: linear-gradient(135deg, #c9a94e, #e8c96a);
    color: #fff;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(201, 169, 78, 0.2);
    transition: box-shadow .3s, transform .2s;
    text-decoration: none;
    display: inline-block;
}
.btn-glow:hover {
    box-shadow: 0 6px 25px rgba(201, 169, 78, 0.35);
    transform: translateY(-1px);
}

/* ============================================ */
/*  Layout — migrated from layout.php inline    */
/* ============================================ */

:root {
    --bg: #08080a;
    --sidebar: linear-gradient(180deg, #0f0d0a 0%, #08080a 100%);
    --surface: rgba(12, 12, 14, 0.65);
    --text: #ececed;
    --text-muted: #7a7a7e;
    --text-secondary: #a8a8ac;
    --text-dim: #5a5a5e;
    --primary: #c9a94e;
    --primary-start: #c9a94e;
    --primary-end: #e8c96a;
    --primary-dim: #a08430;
    --border: rgba(201, 169, 78, 0.45);
    --link: #c9a94e;
    --danger: #e85050;
    --radius: 10px;
    --radius-lg: 14px;
    --glow: rgba(201, 169, 78, 0.12);
    --accent: #c9a94e;
    --card-bg: rgba(12, 12, 14, 0.65);
    --card-glass: rgba(12, 12, 14, 0.65);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--text); display:flex; min-height:100vh; }
a { color:var(--link); transition:color .2s; }
a:hover { color:#e8c96a; }
.sidebar {
    width:220px; min-width:220px;
    background:var(--sidebar);
    display:flex; flex-direction:column;
    padding:5px 5px 0;
    position:fixed; left:0; top:0; bottom:0; z-index:100;
    transition:width .2s,min-width .2s;
    overflow:hidden;
    border-right:1px solid var(--border);
    backdrop-filter:blur(16px);
    -webkit-backdrop-filter:blur(16px);
}
.sidebar.collapsed {
    width:42px; min-width:42px;
}
body:has(.sidebar.collapsed) .main {
    margin-left:42px;
}
.sidebar.collapsed .sidebar-nav a span:not(.icon) { display:none; }
.sidebar.collapsed .sidebar-nav .icon { margin:0; }
.sidebar.collapsed .sidebar-nav a { justify-content:center; padding:9px 0; }
.sidebar.collapsed .sidebar-user span { display:none; }
.sidebar.collapsed .sidebar-user { justify-content:center; }
 .sidebar.collapsed .sidebar-footer { display:none; }
.sidebar.collapsed .sidebar-nav-wrap { overflow-y:hidden; }
.sidebar-nav-wrap {
    flex:1; overflow-y:auto;
    scrollbar-width:thin; scrollbar-color:var(--border) transparent;
}
.sidebar-nav-wrap::-webkit-scrollbar { width:4px; }
.sidebar-nav-wrap::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
.sidebar-lang { padding:8px 0; text-align:center; }
.sidebar-lang select { width:90%; }
    .sidebar-header { padding:8px 4px 20px 4px; }
.sidebar-nav { flex:1; min-height:0; display:flex; flex-direction:column; }
.sidebar-nav a {
    display:flex; align-items:center; gap:8px;
    padding:9px 12px; border-radius:8px;
    text-decoration:none; color:var(--text-muted);
    font-size:.9rem; transition:all .15s;
    margin-bottom:2px;
}
.sidebar-nav a:hover { background:rgba(201,169,78,0.06); color:#ececed; }
.sidebar-nav a.active {
    background:linear-gradient(90deg,rgba(201,169,78,0.12),transparent);
    color:#e8c96a;
    font-weight:600;
    border-left:3px solid;
    border-image:linear-gradient(180deg,#c9a94e,#e8c96a) 1;
    padding-left:9px;
}
.sidebar-nav .icon { width:20px; text-align:center; font-size:1rem; flex-shrink:0; }
.sidebar-divider { border:none; border-top:1px solid var(--border); margin:10px 0; }
.sidebar-user {
    display:flex; align-items:center; gap:8px;
    padding:8px 4px; margin-top:auto;
}
.sidebar-user img { width:28px; height:28px; border-radius:50%; flex-shrink:0; }
.top-bar { display:flex; align-items:center; gap:12px; position:fixed; top:12px; right:20px; z-index:100; }
.top-bar .avatar { width:32px; height:32px; border-radius:50%; cursor:pointer; border:2px solid var(--border); transition:border .2s; }
.top-bar .bell { font-size:1.3rem; cursor:pointer; color:var(--text-muted); position:relative; transition:color .2s; }
.top-bar .bell:hover { color:var(--text); }
.top-bar .bell .notif-dot { position:absolute; top:-4px; right:-6px; min-width:16px; height:16px; border-radius:8px; background:#ff4444; color:#fff; font-size:.6rem; font-weight:700; display:flex; align-items:center; justify-content:center; padding:0 4px; display:none; }
.notif-panel { position:fixed; top:52px; right:20px; width:360px; max-height:400px; overflow-y:auto; background:rgba(12,12,14,0.65); border:1px solid var(--border); border-radius:12px; box-shadow:0 8px 32px rgba(0,0,0,.4); z-index:200; display:none; }
@media (min-width:769px) {
    .top-bar { display:flex; align-items:center; gap:12px; position:fixed; top:12px; right:20px; z-index:100; }
    .top-bar .avatar { width:32px; height:32px; border-radius:50%; cursor:pointer; border:2px solid var(--border); transition:border .2s; }
    .top-bar .avatar:hover { border-color:var(--primary); }
    .top-bar .bell { font-size:1.3rem; cursor:pointer; color:var(--text-muted); position:relative; transition:color .2s; }
    .top-bar .bell:hover { color:var(--text); }
    .top-bar .bell .notif-dot { position:absolute; top:-4px; right:-6px; min-width:16px; height:16px; border-radius:8px; background:#ff4444; color:#fff; font-size:.6rem; font-weight:700; display:flex; align-items:center; justify-content:center; padding:0 4px; display:none; }
    .notif-panel { position:fixed; top:52px; right:20px; width:360px; max-height:400px; overflow-y:auto; background:rgba(12,12,14,0.65); border:1px solid var(--border); border-radius:12px; box-shadow:0 8px 32px rgba(0,0,0,.4); z-index:200; display:none; }
    .notif-panel .notif-header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:1px solid var(--border); font-size:.85rem; }
    .notif-panel .notif-header span { font-weight:600; color:var(--text); }
    .notif-panel .notif-header button { background:none; border:none; color:var(--primary); cursor:pointer; font-size:.8rem; }
    .notif-panel .notif-item { display:flex; gap:10px; padding:10px 16px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s; }
    .notif-panel .notif-item:hover { background:rgba(255,255,255,.03); }
    .notif-panel .notif-item.unread { background:rgba(0,229,160,.05); }
    .notif-panel .notif-item .notif-icon { font-size:1rem; flex-shrink:0; width:24px; text-align:center; }
    .notif-panel .notif-item .notif-body { flex:1; min-width:0; }
    .notif-panel .notif-item .notif-summary { font-size:.82rem; color:var(--text); line-height:1.3; }
    .notif-panel .notif-item .notif-time { font-size:.7rem; color:var(--text-muted); margin-top:2px; }
    .notif-panel .notif-empty { padding:32px 16px; text-align:center; color:var(--text-muted); font-size:.85rem; }
}
.sidebar-toggle {
    background:#151528; border:1px solid #151528; color:var(--text-muted);
    cursor:pointer; font-size:1.2rem; padding:4px;
    z-index:10; width:30px; height:34px;
}
.sidebar-header .sidebar-toggle {
    position:static; align-self:center;
}
.main {
    flex:1; display:flex; flex-direction:column;
    margin-left:220px; padding:0;
    background: linear-gradient(181deg, #0a0a1a 0%, #c9a94e 50%, #1665342b 100%);
}
.page-content {
    max-width:800px; width:100%;
    margin:0 auto; padding:32px 24px;
    background:rgba(12,12,14,0.65);
    min-height:100vh;
    box-shadow:0 0 40px rgba(0,0,0,0.3);
    border-left:1px solid rgba(255,255,255,0.04);
    border-right:1px solid rgba(255,255,255,0.04);
}
.page-content h1 { font-size:1.5rem; margin-bottom:16px; }
.page-content h2 { font-size:1.2rem; margin:20px 0 10px; }
.sidebar-footer { font-size:.75rem; color:var(--text-muted); padding:10px 0; text-align:center; border-top:1px solid rgba(201,169,78,0.1); margin-top:4px; }
hr { border:none; border-top:1px solid var(--border); margin:20px 0; }
/* Form styles */
.form-doflow { margin:16px 0; }
.flow-form { margin-bottom:12px; }
.flow-form input[type="text"],
.flow-form textarea,
.flow-form input[type="url"] {
    width:100%; padding:10px 12px;
    background:rgba(12,12,14,0.65); color:var(--text);
    border:1px solid var(--border); border-radius:8px;
    font-family:inherit; font-size:.95rem;
    outline:none; transition:border-color .15s;
}
.flow-form textarea { resize:vertical; min-height:80px; }
.flow-form input:focus, .flow-form textarea:focus { border-color:var(--primary); }
.flow-form label { display:flex; align-items:center; gap:8px; font-size:.9rem; color:var(--text-muted); cursor:pointer; }
button[type="submit"] {
    background:var(--primary); color:#000; border:none;
    padding:8px 20px; border-radius:8px;
    font-weight:600; cursor:pointer; font-size:.9rem;
    transition:opacity .15s;
}
button[type="submit"]:hover { opacity:.85; }
/* Mobile sidebar — auto-collapse, no hamburger needed */
@media (max-width:768px) {
    body { flex-direction:column; }
    .sidebar {
        width:42px; min-width:42px;
        left:0; /* always visible, collapsed */
    }
    .sidebar .sidebar-nav a span:not(.icon) { display:none; }
    .sidebar .sidebar-nav .icon { margin:0; }
    .sidebar .sidebar-nav a { justify-content:center; padding:9px 0; }
    .sidebar .sidebar-user span { display:none; }
    .sidebar .sidebar-user { justify-content:center; }
    .sidebar .sidebar-footer { display:none; }
    .sidebar .sidebar-nav-wrap { overflow-y:hidden; }
    .sidebar #sidebarSearchBar { display:none !important; }
    .sidebar #sidebarSearchToggle { display:none; }
    /* Expand on toggle click */
    .sidebar.expanded {
        width:220px; min-width:220px;
    }
    .sidebar.expanded .sidebar-nav a span:not(.icon) { display:inline; }
    .sidebar.expanded .sidebar-nav a { justify-content:flex-start; padding:9px 12px; }
    .sidebar.expanded .sidebar-user span { display:inline; }
    .sidebar.expanded .sidebar-user { justify-content:flex-start; }
    .sidebar.expanded .sidebar-footer { display:block; }
    .sidebar.expanded #sidebarSearchBar { display:block !important; }
    .sidebar.expanded #sidebarSearchToggle { display:inline; }
    .sidebar.expanded .sidebar-nav-wrap { overflow-y:auto; }
    .main { margin-left:42px; padding-top:0; }
    .sidebar.expanded ~ .main { margin-left:220px; }
    .page-content { padding:16px 12px; }
}

/* ============================================ */
/*  Premium Dark — Neural Dark Theme            */
/* ============================================ */

/* === Hero Mesh Gradient === */
.hero-mesh {
    position: relative;
    overflow: hidden;
}
.hero-mesh::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201,169,78,0.12) 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation: meshFloat 10s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
.hero-mesh::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201,169,78,0.08) 0%, transparent 70%);
    bottom: -150px;
    right: -80px;
    animation: meshFloat 12s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: 0;
}
.hero-mesh > * {
    position: relative;
    z-index: 1;
}
@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* === Hero Badge === */
.hero-badge {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(201,169,78,0.08);
    border: 1px solid rgba(201,169,78,0.15);
    color: var(--primary);
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

/* === Entry Animations === */
.anim-in {
    animation: animFadeIn 0.7s ease both;
}
.anim-up {
    animation: animFadeUp 0.7s ease both;
}
.anim-up-1 { animation-delay: 0.1s; }
.anim-up-2 { animation-delay: 0.2s; }
.anim-up-3 { animation-delay: 0.3s; }
.anim-up-4 { animation-delay: 0.4s; }
.anim-up-5 { animation-delay: 0.5s; }
.anim-up-6 { animation-delay: 0.6s; }
.anim-up-7 { animation-delay: 0.7s; }
.anim-up-8 { animation-delay: 0.8s; }
@keyframes animFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes animFadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Shimmer Gradient Text === */
.shimmer {
    background: linear-gradient(90deg, #c9a94e 0%, #e8c96a 25%, #f0d878 50%, #e8c96a 75%, #c9a94e 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}
@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* === Glass Card === */
.card-glass {
    background: rgba(12, 12, 14, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(201,169,78,0.06);
    border-radius: var(--radius-lg, 14px);
    padding: 32px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.35s, box-shadow 0.35s, transform 0.3s;
}
.card-glass::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(201,169,78,0.05) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.35s;
    pointer-events: none;
}
.card-glass:hover {
    border-color: rgba(201,169,78,0.18);
    box-shadow: 0 0 40px rgba(201,169,78,0.06), 0 12px 40px rgba(0,0,0,0.3);
    transform: translateY(-6px);
}
.card-glass:hover::before {
    opacity: 1;
}
.card-glass h3 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
}
.card-glass p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}
.card-glass .card-icon {
    font-size: 2.2rem;
    margin-bottom: 16px;
    display: inline-block;
    filter: drop-shadow(0 0 12px rgba(201,169,78,0.25));
}

/* === Sidebar Breathing Glow === */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(201,169,78,0.2) 50%, transparent 100%);
    animation: sidebarBreathe 5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes sidebarBreathe {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* === Sidebar Active Item Enhanced === */
.sidebar-nav a.active {
    box-shadow: 0 0 16px rgba(201,169,78,0.08);
}

/* === Button Glow === */
.btn-primary {
    transition: box-shadow 0.3s, transform 0.2s, background 0.2s;
}
.btn-primary:hover {
    box-shadow: 0 0 24px rgba(201,169,78,0.3), 0 4px 16px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}
.btn-secondary:hover {
    box-shadow: 0 0 16px rgba(201,169,78,0.1);
    transform: translateY(-1px);
}

/* === Grid 3 Enhanced === */
.grid-3 {
    position: relative;
    z-index: 1;
}

/* === Marketplace Card Enhanced === */
.mp-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.mp-card:hover {
    box-shadow: 0 0 30px rgba(201,169,78,0.08), 0 8px 24px rgba(0,0,0,0.3);
}

/* === Status Pulse === */
.mp-status-dot {
    animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* === Hero Subtitle Enhanced === */
.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* === Page Content Enhanced === */
/*
.page-content {
    background: linear-gradient(180deg, rgb(49 49 113 / 70%) 0%, rgb(0 0 0 / 95%) 100%);
}
*/
/* === Divider with glow === */
.divider-glow {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,169,78,0.15), transparent);
    margin: 48px 0;
}

/* === Search Panel (live results in page-content) === */
.search-panel {
    display: none;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}
.search-panel .sp-loading,
.search-panel .sp-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.search-panel .sp-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.search-panel .sp-header strong { color: var(--primary); }
.search-panel .sp-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 6px;
}
.search-panel .sp-item:hover {
    background: rgba(201,169,78,0.05);
    border-color: rgba(201,169,78,0.12);
}
.search-panel .sp-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    margin-top: 2px;
}
.search-panel .sp-body { flex: 1; min-width: 0; }
.search-panel .sp-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.search-panel .sp-type {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--primary);
    background: rgba(201,169,78,0.08);
    padding: 1px 8px;
    border-radius: 8px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.search-panel .sp-highlight {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.search-panel .sp-highlight b { color: var(--primary); font-weight: 600; }
.search-panel .sp-more {
    display: block;
    padding: 14px 16px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--primary);
    text-decoration: none;
    border: 1px solid rgba(201,169,78,0.12);
    border-radius: var(--radius);
    margin-top: 8px;
    transition: background 0.15s;
}
.search-panel .sp-more:hover { background: rgba(201,169,78,0.06); }

/* === Articles (bài viết content factory public) === */
.article-chapter { margin-bottom: 0; }
.article-chapter h2 { margin: 26px 0 12px; color: var(--primary); font-size: 1.25rem; line-height: 1.4; }
.article-cover { margin: 0 0 24px; }
.article-cover img,
.article-chapter img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 12px 0; }
.article-meta { margin: 0 0 8px; font-size: 0.85rem; color: var(--text-dim, #888); }
.article-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }
/* Mục lục bài viết — click scroll đúng chương */
.article-toc {
    margin: 0 0 22px; padding: 14px 18px;
    border: 1px solid var(--border); border-left: 3px solid var(--primary);
    border-radius: 10px; background: rgba(201,169,78,0.04);
}
.article-toc strong { font-size: 0.85rem; color: var(--text-dim, #888); }
.article-toc ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.article-toc li { font-size: 0.85rem; }
.article-toc a { color: var(--text); text-decoration: none; }
.article-toc a:hover { color: var(--primary); }
html { scroll-behavior: smooth; }
.article-chapter h2[id^="chap-"] { scroll-margin-top: 80px; }
.article-blockquote, .article-chapter blockquote {
    border-left: 3px solid var(--primary); padding-left: 14px; color: var(--text-dim); margin: 12px 0;
}
.article-chapter table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.article-chapter th, .article-chapter td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; font-size: 0.85rem; }
.article-chapter th { background: rgba(201,169,78,0.08); }
.article-chapter pre { background: #1a1a2e; padding: 14px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.article-chapter code { background: #1a1a2e; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }
.article-chapter pre code { background: none; padding: 0; }
.article-chapter .mermaid { display: flex; justify-content: center; margin: 16px 0; overflow-x: auto; }
.article-chapter .mermaid svg { max-width: 100%; }
.article-chapter ul, .article-chapter ol { margin: 10px 0 10px 24px; }
.article-chapter li { margin: 4px 0; }

/* Articles list */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.article-card { text-decoration: none; color: inherit; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius, 12px); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.article-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.article-card img { width: 100%; height: 150px; object-fit: cover; border-bottom: 1px solid var(--border); }
.article-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.article-card h3 { margin: 0; font-size: 0.95rem; line-height: 1.4; color: var(--primary); }
.article-card .meta { font-size: 0.75rem; }
.article-card .excerpt { font-size: 0.82rem; }
