:root{
    --bg:#f5f7fb;
    --surface:#ffffff;
    --surface-2:#f8fafc;
    --surface-3:#eef2f7;
    --text:#121826;
    --muted:#6b7280;
    --border:#e4e8ef;
    --accent:#5b5cf0;
    --accent-2:#7847ff;
    --success:#16a34a;
    --warning:#d97706;
    --danger:#dc2626;
    --shadow:0 10px 40px rgba(15,23,42,.07);
    --radius:16px;
}

html[data-theme="dark"]{
    --bg:#07101d;
    --surface:#0d1726;
    --surface-2:#111d2e;
    --surface-3:#17253a;
    --text:#e8eef8;
    --muted:#8998ad;
    --border:#22334a;
    --accent:#7c83ff;
    --accent-2:#a467ff;
    --success:#34d399;
    --warning:#fbbf24;
    --danger:#fb7185;
    --shadow:0 14px 50px rgba(0,0,0,.28);
}

body{
    background:var(--bg);
    color:var(--text);
    transition:background .2s,color .2s;
}

.main{
    background:
        radial-gradient(
            circle at 75% 0%,
            rgba(91,92,240,.05),
            transparent 34%
        ),
        var(--bg);
}

.stat,
.panel,
.agent-card,
.integration-card,
.placeholder,
.empty,
.modal,
.auth-card,
.knowledge-space,
.feature-card,
.channel-card{
    background:var(--surface);
    color:var(--text);
    border-color:var(--border);
    box-shadow:var(--shadow);
}

input,
textarea,
select,
.secondary{
    background:var(--surface);
    color:var(--text);
    border-color:var(--border);
}

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

.primary{
    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent-2)
        );
    border:none;
    box-shadow:
        0 8px 24px
        color-mix(in srgb,var(--accent) 24%,transparent);
}

.sidebar{
    background:#0c1320;
    border-right:1px solid rgba(255,255,255,.05);
}

.brand{
    letter-spacing:-.03em;
}

.nav-group-title{
    font-size:10px;
    letter-spacing:.14em;
    color:#68758a;
    padding:18px 12px 7px;
    font-weight:800;
}

.nav a{
    position:relative;
    transition:.15s ease;
}

.nav a.active{
    background:
        linear-gradient(
            90deg,
            rgba(124,131,255,.18),
            rgba(124,131,255,.04)
        );
}

.nav a.active::before{
    content:"";
    position:absolute;
    left:0;
    top:8px;
    bottom:8px;
    width:3px;
    border-radius:10px;
    background:#818cf8;
}

.page-hero{
    display:flex;
    justify-content:space-between;
    gap:20px;
    align-items:flex-start;
    margin-bottom:24px;
}

.page-hero h2{
    margin:4px 0 5px;
    font-size:26px;
}

.eyebrow{
    color:var(--accent);
    font-size:11px;
    letter-spacing:.16em;
    font-weight:850;
}

.work-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:16px;
}

.feature-card{
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:22px;
}

.feature-icon{
    width:42px;
    height:42px;
    border-radius:12px;
    display:grid;
    place-items:center;
    background:var(--surface-3);
    margin-bottom:18px;
    font-weight:800;
}

.feature-state{
    display:inline-block;
    padding:6px 9px;
    border-radius:30px;
    background:var(--surface-3);
    color:var(--muted);
    font-size:12px;
}

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

.status-ok{
    background:var(--success);
}

.status-warn{
    background:var(--warning);
}

.status-error{
    background:var(--danger);
}

.status-off{
    background:#64748b;
}

.runtime-pill{
    display:inline-flex;
    align-items:center;
    border:1px solid var(--border);
    background:var(--surface-2);
    border-radius:30px;
    padding:6px 9px;
    font-size:12px;
    color:var(--muted);
}

.channel-card{
    border:1px solid var(--border);
    border-radius:18px;
    padding:22px;
    margin-bottom:16px;
}

.channel-head{
    display:flex;
    justify-content:space-between;
    gap:18px;
    align-items:flex-start;
}

.channel-name{
    font-size:19px;
    font-weight:800;
}

.channel-tree{
    margin-top:18px;
    border-left:2px solid var(--border);
    padding-left:20px;
}

.channel-route{
    position:relative;
    display:grid;
    grid-template-columns:minmax(220px,1fr) minmax(220px,1fr);
    gap:14px;
    padding:13px 0;
}

.channel-route::before{
    content:"";
    position:absolute;
    left:-21px;
    top:26px;
    width:20px;
    border-top:2px solid var(--border);
}

.route-source,
.route-agent{
    border:1px solid var(--border);
    border-radius:12px;
    padding:13px;
    background:var(--surface-2);
}

.route-arrow{
    display:none;
}

.dashboard-grid{
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:14px;
}

.metric-card{
    border:1px solid var(--border);
    background:var(--surface);
    border-radius:16px;
    padding:18px;
    box-shadow:var(--shadow);
}

.metric-label{
    font-size:12px;
    color:var(--muted);
}

.metric-value{
    font-size:28px;
    font-weight:850;
    margin-top:8px;
}

.dashboard-two{
    display:grid;
    grid-template-columns:1.15fr .85fr;
    gap:16px;
    margin-top:16px;
}

.progress{
    height:8px;
    border-radius:20px;
    overflow:hidden;
    background:var(--surface-3);
}

.progress > div{
    height:100%;
    border-radius:20px;
    background:
        linear-gradient(
            90deg,
            var(--accent),
            var(--accent-2)
        );
}

.appearance-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
}

.appearance-option{
    border:1px solid var(--border);
    border-radius:13px;
    padding:15px;
    background:var(--surface-2);
}


/* AI NEXUS */

html[data-style="nexus"]{
    --radius:20px;
}

html[data-style="nexus"] body{
    background:#030712;
}

html[data-style="nexus"] .main{
    background:
        radial-gradient(
            circle at 15% 10%,
            rgba(56,189,248,.13),
            transparent 28%
        ),
        radial-gradient(
            circle at 90% 5%,
            rgba(168,85,247,.16),
            transparent 30%
        ),
        linear-gradient(
            180deg,
            #050816,
            #07101d
        );
}

html[data-style="nexus"][data-theme="light"] .main{
    background:
        radial-gradient(
            circle at 15% 10%,
            rgba(56,189,248,.10),
            transparent 28%
        ),
        radial-gradient(
            circle at 90% 5%,
            rgba(168,85,247,.10),
            transparent 30%
        ),
        var(--bg);
}

html[data-style="nexus"] .stat,
html[data-style="nexus"] .panel,
html[data-style="nexus"] .metric-card,
html[data-style="nexus"] .agent-card,
html[data-style="nexus"] .integration-card,
html[data-style="nexus"] .channel-card{
    backdrop-filter:blur(20px);
    border-color:
        color-mix(
            in srgb,
            var(--accent) 20%,
            var(--border)
        );
}

html[data-style="nexus"][data-theme="dark"] .stat,
html[data-style="nexus"][data-theme="dark"] .panel,
html[data-style="nexus"][data-theme="dark"] .metric-card,
html[data-style="nexus"][data-theme="dark"] .agent-card,
html[data-style="nexus"][data-theme="dark"] .integration-card,
html[data-style="nexus"][data-theme="dark"] .channel-card{
    background:rgba(10,19,34,.73);
    box-shadow:
        0 0 0 1px rgba(124,131,255,.04),
        0 18px 70px rgba(0,0,0,.32);
}

html[data-style="nexus"] .brand::after{
    content:" AI";
    color:#818cf8;
    font-size:10px;
    vertical-align:top;
    margin-left:5px;
    letter-spacing:.08em;
}


@media(max-width:1300px){
    .dashboard-grid{
        grid-template-columns:repeat(3,1fr);
    }
}

@media(max-width:950px){
    .work-grid,
    .dashboard-two,
    .appearance-grid{
        grid-template-columns:1fr;
    }

    .dashboard-grid{
        grid-template-columns:repeat(2,1fr);
    }

    .channel-route{
        grid-template-columns:1fr;
    }
}


/* Sidebar behaviour */

.sidebar{
    overflow-y:auto;
    overflow-x:hidden;
    scrollbar-width:thin;
    scrollbar-color:
        #334155
        transparent;
}

.sidebar::-webkit-scrollbar{
    width:6px;
}

.sidebar::-webkit-scrollbar-thumb{
    background:#334155;
    border-radius:10px;
}


/* Profile */

.settings-profile-grid{
    display:grid;
    grid-template-columns:220px minmax(0,560px);
    gap:32px;
    margin-top:22px;
}

.profile-avatar-box{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.profile-avatar-preview{
    width:128px;
    height:128px;
    border-radius:32px;
    display:grid;
    place-items:center;
    overflow:hidden;
    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent-2)
        );
    color:white;
    font-size:44px;
    font-weight:850;
    box-shadow:var(--shadow);
}

.profile-avatar-preview img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.top-avatar{
    display:inline-grid;
    width:34px;
    height:34px;
    place-items:center;
    overflow:hidden;
    border-radius:50%;
    margin-right:9px;
    vertical-align:middle;
    color:white;
    font-size:13px;
    font-weight:800;
    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent-2)
        );
}

.top-avatar img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.settings-general-form label{
    margin-top:15px;
}


@media(max-width:900px){

    .settings-profile-grid{
        grid-template-columns:1fr;
    }
}
