:root{
    --bg:#060b1a;
    --bg2:#0a1022;
    --panel:#10182b;
    --panel2:#121d33;
    --line:rgba(255,255,255,.08);
    --line2:rgba(123,150,255,.18);
    --text:#f5f7ff;
    --muted:#94a3b8;
    --blue:#5b7cff;
    --blue2:#7c4dff;
    --green:#22c55e;
    --red:#ef4444;
    --orange:#f59e0b;
    --cyan:#38bdf8;
}

*{
    box-sizing:border-box;
}

html,body{
    margin:0;
    padding:0;
    background:
        radial-gradient(circle at 20% 10%, rgba(91,124,255,.22), transparent 25%),
        radial-gradient(circle at 80% 20%, rgba(124,77,255,.18), transparent 20%),
        linear-gradient(180deg, #050913 0%, #091126 100%);
    color:var(--text);
    font-family:Inter, Arial, sans-serif;
}

a{
    text-decoration:none;
}

.app-shell{
    min-height:100vh;
}

.topbar{
    position:fixed;
    top:0;
    left:280px;
    right:0;
    height:72px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 24px;
    background:rgba(6,11,26,.7);
    border-bottom:1px solid var(--line);
    backdrop-filter:blur(16px);
    z-index:50;
}

.topbar-left,
.topbar-right{
    display:flex;
    align-items:center;
    gap:16px;
}

.brand-inline{
    display:flex;
    align-items:center;
    gap:10px;
}

.brand-dot{
    width:10px;
    height:10px;
    border-radius:50%;
    background:linear-gradient(135deg,#55d0ff,#7a5cff);
    box-shadow:0 0 18px rgba(85,208,255,.85);
}

.brand-title{
    font-size:26px;
    font-weight:800;
    letter-spacing:.01em;
}

.live-badge{
    padding:4px 10px;
    border-radius:999px;
    font-size:11px;
    font-weight:800;
    color:#b7ffcb;
    border:1px solid rgba(34,197,94,.35);
    background:rgba(34,197,94,.12);
}

.topbar-user{
    text-align:right;
}

.topbar-user-name{
    font-size:14px;
    font-weight:700;
}

.topbar-user-role{
    font-size:12px;
    color:var(--muted);
}

.topbar-avatar{
    width:38px;
    height:38px;
    border-radius:50%;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,#ffb86b,#ff7ab6);
    color:#fff;
    font-weight:800;
}

.sidebar{
    position:fixed;
    top:0;
    left:0;
    bottom:0;
    width:280px;
    background:rgba(4,9,20,.92);
    border-right:1px solid var(--line);
    backdrop-filter:blur(18px);
    padding:18px 16px;
    display:flex;
    flex-direction:column;
    z-index:60;
}

.sidebar-brand{
    margin-bottom:18px;
}

.brand-row{
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:18px;
}

.sidebar-user-card{
    background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
    border:1px solid var(--line);
    border-radius:18px;
    padding:16px;
}

.sidebar-user-name{
    font-size:18px;
    font-weight:800;
    margin-bottom:4px;
}

.sidebar-user-role{
    font-size:13px;
    color:var(--muted);
}

.sidebar-nav{
    display:flex;
    flex-direction:column;
    gap:8px;
    overflow:auto;
    padding-right:4px;
}

.sidebar-link{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border-radius:14px;
    color:#dbe7ff;
    transition:.2s ease;
    border:1px solid transparent;
    font-size:14px;
    font-weight:600;
}

.sidebar-link:hover{
    background:rgba(255,255,255,.05);
    color:#fff;
    border-color:var(--line);
}

.sidebar-link.active{
    background:linear-gradient(135deg, rgba(91,124,255,.28), rgba(124,77,255,.24));
    color:#fff;
    border-color:rgba(123,150,255,.32);
    box-shadow:0 10px 30px rgba(91,124,255,.12);
}

.sidebar-icon{
    width:22px;
    text-align:center;
    flex-shrink:0;
}

.sidebar-bottom{
    margin-top:auto;
    padding-top:16px;
}

.sidebar-link-danger{
    color:#ffc2c2;
    border:1px solid rgba(239,68,68,.18);
    background:rgba(239,68,68,.08);
}

.sidebar-link-danger:hover{
    background:rgba(239,68,68,.16);
    color:#fff;
}

.app-main{
    margin-left:280px;
    padding-top:92px;
    min-height:100vh;
}

.container-fluid{
    padding:24px;
}

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

.page-kicker{
    font-size:12px;
    font-weight:800;
    letter-spacing:.14em;
    text-transform:uppercase;
    color:#6bb6ff;
    margin-bottom:8px;
}

h1,h2,h3,h4,h5{
    margin-top:0;
    color:#fff;
}

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

.card-soft,
.metric-card,
.dashboard-card,
.quick-card,
.chart-card,
.table-card{
    background:
        linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
    border:1px solid var(--line);
    border-radius:22px;
    box-shadow:
        0 10px 40px rgba(0,0,0,.24),
        inset 0 1px 0 rgba(255,255,255,.04);
}

.card-soft{
    padding:22px;
}

.form-control,
.form-select,
textarea{
    background:rgba(255,255,255,.06)!important;
    border:1px solid rgba(255,255,255,.08)!important;
    color:#fff!important;
    border-radius:14px!important;
    min-height:48px;
    box-shadow:none!important;
}

.form-control::placeholder,
textarea::placeholder{
    color:#7f8ba7!important;
}

.form-label{
    color:#dbe7ff;
    font-weight:700;
    margin-bottom:10px;
}

.btn{
    border-radius:14px;
    font-weight:800;
    padding:12px 18px;
    border:1px solid transparent;
}

.btn-primary{
    color:#fff;
    background:linear-gradient(90deg, #5a7cff 0%, #8c52ff 100%);
    border:0;
    box-shadow:0 12px 30px rgba(91,124,255,.3);
}

.btn-primary:hover{
    color:#fff;
    transform:translateY(-1px);
}

.btn-success{
    color:#fff;
    background:linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
    border:0;
}

.btn-outline-primary{
    color:#cdd7ff;
    border-color:rgba(91,124,255,.45);
    background:rgba(91,124,255,.08);
}

.btn-outline-secondary{
    color:#d7deec;
    border-color:rgba(255,255,255,.12);
    background:rgba(255,255,255,.04);
}

.btn-dark{
    color:#fff;
    background:rgba(255,255,255,.08);
    border-color:rgba(255,255,255,.08);
}

.quick-icon{
    width:48px;
    height:48px;
    border-radius:16px;
    display:grid;
    place-items:center;
    font-size:22px;
    background:linear-gradient(135deg, rgba(91,124,255,.24), rgba(124,77,255,.24));
    border:1px solid var(--line2);
}

.badge-ai{
    display:inline-flex;
    align-items:center;
    gap:8px;
    border-radius:999px;
    padding:7px 12px;
    font-size:12px;
    font-weight:800;
    background:rgba(91,124,255,.12);
    border:1px solid rgba(91,124,255,.24);
    color:#bfd0ff;
}

.pipeline-list{
    display:flex;
    flex-direction:column;
    gap:14px;
}

.pipeline-item{
    display:flex;
    align-items:center;
    gap:12px;
    color:#d6e1ff;
    font-weight:600;
}

.pipeline-item span{
    width:10px;
    height:10px;
    border-radius:50%;
    background:linear-gradient(135deg,#54ff8c,#30d1ff);
    box-shadow:0 0 12px rgba(48,209,255,.45);
}

.dashboard-grid{
    display:grid;
    grid-template-columns:1.3fr .7fr;
    gap:20px;
}

.stats-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:16px;
    margin-top:20px;
}

.metric-card{
    padding:18px;
}

.metric-card-label{
    color:#9fb0d0;
    font-size:13px;
    margin-bottom:8px;
}

.metric-card-value{
    font-size:34px;
    font-weight:800;
    line-height:1;
    margin-bottom:8px;
}

.metric-card-sub{
    font-size:13px;
    color:var(--muted);
}

.progress-wrap{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.progress-row{
    display:grid;
    grid-template-columns:160px 1fr 44px;
    gap:12px;
    align-items:center;
    font-size:13px;
    color:#cdd7ef;
}

.progress-bar-shell{
    height:8px;
    border-radius:999px;
    background:rgba(255,255,255,.06);
    overflow:hidden;
}

.progress-bar-ai{
    height:100%;
    width:0;
    border-radius:999px;
    background:linear-gradient(90deg,#5a7cff,#8f5dff);
    transition:1.2s ease;
}

.work-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
}

.work-step{
    display:flex;
    gap:12px;
    align-items:flex-start;
    padding:14px;
    border:1px solid var(--line);
    border-radius:16px;
    background:rgba(255,255,255,.03);
}

.work-step-num{
    width:28px;
    height:28px;
    border-radius:50%;
    display:grid;
    place-items:center;
    font-size:12px;
    font-weight:800;
    color:#fff;
    background:linear-gradient(135deg,#5a7cff,#8f5dff);
    flex-shrink:0;
}

.modern-table{
    margin:0;
    color:#eaf0ff;
}

.modern-table thead th{
    border-bottom:1px solid var(--line)!important;
    color:#8fb5ff;
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.08em;
    font-weight:800;
    background:transparent!important;
}

.modern-table td{
    border-color:rgba(255,255,255,.06)!important;
    vertical-align:middle;
    background:transparent!important;
}

.type-badge{
    display:inline-flex;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    background:rgba(91,124,255,.14);
    color:#d8e4ff;
    border:1px solid rgba(91,124,255,.22);
}

.empty-state{
    text-align:center;
    padding:50px 20px;
}

.empty-icon{
    font-size:44px;
    margin-bottom:14px;
}

.sidebar-overlay{
    display:none;
}

.mobile-menu-btn{
    display:none;
    width:42px;
    height:42px;
    border-radius:12px;
    border:1px solid var(--line);
    background:rgba(255,255,255,.06);
    color:#fff;
}

.ai-toast{
    position:fixed;
    right:20px;
    bottom:20px;
    z-index:9999;
    padding:14px 18px;
    border-radius:14px;
    color:#fff;
    font-weight:700;
    transform:translateY(20px);
    opacity:0;
    transition:.3s ease;
    box-shadow:0 16px 40px rgba(0,0,0,.28);
}

.ai-toast.show{
    opacity:1;
    transform:translateY(0);
}

.ai-toast-success{
    background:linear-gradient(135deg,#16a34a,#22c55e);
}

.ai-toast-error{
    background:linear-gradient(135deg,#dc2626,#ef4444);
}

.ai-loading-overlay{
    position:fixed;
    inset:0;
    background:rgba(4,8,18,.78);
    backdrop-filter:blur(10px);
    display:grid;
    place-items:center;
    z-index:9998;
}

.ai-loading-card{
    width:min(560px, calc(100% - 32px));
    border-radius:24px;
    padding:30px;
    background:linear-gradient(180deg, rgba(15,24,43,.95), rgba(10,16,34,.95));
    border:1px solid rgba(255,255,255,.08);
    text-align:center;
}

.ai-spinner{
    width:68px;
    height:68px;
    border-radius:50%;
    margin:0 auto 20px;
    border:5px solid rgba(255,255,255,.08);
    border-top-color:#7f5cff;
    animation:spin 1s linear infinite;
}

.skeleton{
    height:12px;
    border-radius:999px;
    background:linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.12), rgba(255,255,255,.05));
    background-size:200% 100%;
    animation:shine 1.6s infinite linear;
    margin-top:12px;
}

.skeleton-title{height:18px;width:70%;margin:18px auto 0;}
.skeleton-line{width:100%;}
.skeleton-line.short{width:68%;}
.skeleton-line.medium{width:82%;}

@keyframes spin{
    to{transform:rotate(360deg);}
}

@keyframes shine{
    0%{background-position:200% 0;}
    100%{background-position:-200% 0;}
}

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

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

@media (max-width: 900px){
    .sidebar{
        transform:translateX(-100%);
        transition:.25s ease;
    }

    body.sidebar-open .sidebar{
        transform:translateX(0);
    }

    .sidebar-overlay{
        position:fixed;
        inset:0;
        background:rgba(0,0,0,.45);
        z-index:55;
    }

    body.sidebar-open .sidebar-overlay{
        display:block;
    }

    .topbar{
        left:0;
    }

    .app-main{
        margin-left:0;
    }

    .mobile-menu-btn{
        display:grid;
        place-items:center;
    }
}

@media (max-width: 640px){
    .container-fluid{
        padding:16px;
    }

    .page-head{
        flex-direction:column;
    }

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

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

    .progress-row{
        grid-template-columns:1fr;
    }
}