:root{
    --shell-sidebar-w:230px;
    --shell-topbar-h:60px;
    --shell-dark:#191330;
    --shell-dark-2:#241c42;
    --shell-indigo:#4f46e5;
    --shell-violet:#7c3aed;
}

html, body{ height:100%; }
body{ background:#f6f5fb; }

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

/* ---------- Sidebar ---------- */
.app-sidebar{
    width:var(--shell-sidebar-w); flex-shrink:0; background:var(--shell-dark); color:#fff;
    display:flex; flex-direction:column; padding:20px 14px; position:sticky; top:0; height:100vh;
    background-image:linear-gradient(180deg, var(--shell-dark), var(--shell-dark-2));
}
.brand{ display:flex; align-items:center; gap:10px; padding:6px 8px 22px; }
.brand-mark{
    width:32px; height:32px; border-radius:9px; display:flex; align-items:center; justify-content:center;
    background:linear-gradient(135deg, var(--shell-indigo), var(--shell-violet)); font-size:15px;
    box-shadow:0 6px 16px rgba(124,58,237,.4);
}
.brand span{ font-family:'Space Grotesk', sans-serif; font-weight:600; font-size:15px; letter-spacing:.01em; }

.side-nav{ display:flex; flex-direction:column; gap:2px; margin-top:6px; }
.side-nav a{
    display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px;
    color:rgba(255,255,255,.68); text-decoration:none; font-size:13.5px; font-weight:500;
    transition:background .12s ease, color .12s ease;
}
.side-nav a .ic{ font-size:15px; width:18px; text-align:center; }
.side-nav a:hover{ background:rgba(255,255,255,.06); color:#fff; }
.side-nav a.active{
    background:linear-gradient(135deg, rgba(79,70,229,.9), rgba(124,58,237,.9)); color:#fff;
    box-shadow:0 4px 14px rgba(79,70,229,.35);
}

.side-spacer{ flex:1; }
.side-footer{ padding:10px 8px; color:rgba(255,255,255,.35) !important; }

/* ---------- Main column ---------- */
.app-main{ flex:1; min-width:0; display:flex; flex-direction:column; }

.app-topbar{
    height:var(--shell-topbar-h); flex-shrink:0; background:#fff; border-bottom:1px solid #e4e1f2;
    display:flex; align-items:center; padding:0 22px; position:sticky; top:0; z-index:20;
}
.topbar-spacer{ flex:1; }

.user-menu{ position:relative; display:flex; align-items:center; gap:8px; cursor:pointer; padding:6px 8px; border-radius:8px; }
.user-menu:hover{ background:#f4f2fb; }
.avatar{
    width:28px; height:28px; border-radius:50%; background:linear-gradient(135deg, var(--shell-indigo), var(--shell-violet));
    color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700;
}
.user-name{ font-size:13px; font-weight:600; color:#1f1b33; }
.chev{ font-size:10px; color:#9691b3; }

.user-dropdown{
    display:none; position:absolute; top:calc(100% + 8px); right:0; width:200px; background:#fff;
    border:1px solid #e4e1f2; border-radius:10px; box-shadow:0 12px 30px rgba(25,19,48,.15); padding:10px; z-index:30;
}
.user-dropdown.open{ display:block; }
.dropdown-email{ padding:6px 8px 10px; border-bottom:1px solid #eeecf7; margin-bottom:8px; word-break:break-all; }
.dropdown-logout{
    width:100%; text-align:left; background:none; border:none; padding:8px; border-radius:6px; cursor:pointer;
    font-size:13px; color:#b91c1c; font-weight:600;
}
.dropdown-logout:hover{ background:#fef2f2; }

.app-content{ flex:1; min-height:0; }

/* The flow builder manages its own full-height layout inside .app-content;
   account for the shared topbar height so it doesn't double-scroll. */
.builder-shell{ height:calc(100vh - var(--shell-topbar-h)); }

@media (max-width: 860px){
    .app-sidebar{ display:none; } /* keep it simple on small screens; expand with a hamburger later if needed */
}
