:root{
    --bg-main:#0f1113;
    --bg-sidebar:#111315;
    --bg-panel:#181b1f;
    --bg-panel-2:#1d2126;

    --border:#262b31;
    --border-soft:#20242a;

    --text-main:#f3f4f6;
    --text-muted:#9aa4b2;
    --text-soft:#7d8794;

    --accent:#3ecf8e;
    --accent-hover:#2fbe7d;

    --danger:#ef4444;
    --warning:#f59e0b;
    --success:#22c55e;

    --radius:14px;
    --radius-sm:10px;

    --shadow:0 10px 30px rgba(0,0,0,.22);

    --sidebar-width:260px;
    --topbar-height:72px;
}

*{
    box-sizing:border-box;
}

html,
body{
    margin:0;
    padding:0;
    background:var(--bg-main);
    color:var(--text-main);
    font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    overflow-x:hidden;
}

body{
    min-height:100vh;
}

a{
    text-decoration:none;
    color:inherit;
}

button{
    font:inherit;
}

/* APP LAYOUT */

.app-shell{
    display:flex;
    min-height:100vh;
    background:var(--bg-main);
    overflow-x:hidden;
}

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

/* SIDEBAR */

.sidebar{
    width:var(--sidebar-width);
    background:var(--bg-sidebar);
    border-right:1px solid var(--border);
    padding:20px 16px;
    display:flex;
    flex-direction:column;
    gap:20px;
    position:sticky;
    top:0;
    height:100vh;
    z-index:30;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:4px 6px 12px;
    border-bottom:1px solid var(--border-soft);
}

.sidebar-divider{
    height:1px;
    background:var(--border-soft);
    margin:10px 0 4px;
}

.nav-link-logout{
    margin-top:4px;
}

.brand-mark{
    width:38px;
    height:38px;
    border-radius:10px;
    background:linear-gradient(135deg,var(--accent),#1f8f62);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:700;
    color:#09110d;
}

.brand-title{
    font-weight:700;
}

.brand-subtitle{
    font-size:.8rem;
    color:var(--text-muted);
}

.sidebar-nav{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.nav-link{
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 12px;
    border-radius:10px;
    color:var(--text-muted);
    border:1px solid transparent;
    transition:.18s ease;
}

.nav-link:hover{
    background:var(--bg-panel);
    color:var(--text-main);
    border-color:var(--border);
}

.nav-link.active{
    background:rgba(62,207,142,.12);
    color:var(--text-main);
    border-color:rgba(62,207,142,.16);
}

/* TOPBAR */

.topbar{
    height:var(--topbar-height);
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 20px;
    gap:14px;
    background:rgba(15,17,19,.92);
    backdrop-filter:blur(8px);
    position:sticky;
    top:0;
    z-index:20;
}

.topbar-left,
.topbar-right{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
}

.menu-toggle{
    display:none;
    width:46px;
    height:46px;
    border-radius:14px;
    border:1px solid var(--border);
    background:var(--bg-panel);
    color:var(--text-main);
    cursor:pointer;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
}

.workspace-pill{
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 16px;
    background:var(--bg-panel);
    border:1px solid var(--border);
    border-radius:999px;
    font-size:.95rem;
    font-weight:500;
    min-width:0;
    max-width:220px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.workspace-dot{
    width:10px;
    height:10px;
    background:var(--accent);
    border-radius:50%;
    flex:0 0 auto;
}

.workspace-name{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    display:block;
}

.topbar-btn{
    border:1px solid var(--border);
    background:var(--bg-panel);
    padding:10px 14px;
    border-radius:999px;
    color:var(--text-main);
    display:inline-flex;
    align-items:center;
    justify-content:center;
}

.user-pill{
    border:1px solid var(--border);
    background:var(--bg-panel);
    padding:10px 16px;
    border-radius:999px;
    flex:0 0 auto;
    max-width:180px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.logout-btn{
    color:var(--text-main);
    cursor:pointer;
    white-space:nowrap;
}

/* CONTENT */

.app-content{
    padding:28px;
    min-width:0;
    overflow-x:hidden;
}

/* BUTTONS */

.btn{
    border:none;
    border-radius:12px;
    padding:10px 16px;
    cursor:pointer;
    transition:.18s ease;
}

.btn-primary{
    background:var(--accent);
    color:#07110c;
    font-weight:600;
}

.btn-primary:hover{
    background:var(--accent-hover);
}

.btn-secondary{
    background:var(--bg-panel);
    border:1px solid var(--border);
    color:var(--text-main);
}

.btn-secondary:hover{
    background:var(--bg-panel-2);
}

/* PANEL */

.panel{
    background:var(--bg-panel);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:18px;
    box-shadow:var(--shadow);
    min-width:0;
    overflow-x:hidden;
}

/* MOBILE GENERAL */

@media (max-width:900px){

    .sidebar{
        position:fixed;
        left:0;
        top:0;
        bottom:0;
        transform:translateX(-100%);
        transition:transform .25s ease;
        z-index:40;
        width:var(--sidebar-width);
        height:100vh;
    }

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

    .topbar{
        padding:0 14px;
        gap:10px;
    }

    .menu-toggle{
        display:flex;
    }

    .topbar-left{
        flex:1;
        min-width:0;
    }

    .topbar-right{
        flex:0 0 auto;
    }

    .workspace-pill{
        flex:1;
        min-width:0;
        max-width:150px;
        padding:10px 14px;
    }

    .workspace-name{
        font-size:.98rem;
    }

    .user-pill{
        max-width:140px;
        padding:10px 14px;
        font-size:.98rem;
    }

    .logout-btn{
        display:none;
    }

    .app-content{
        padding:18px;
    }
}

/* USERS TABLE MOBILE */

@media (max-width:768px){

    .users-table-wrap,
    .users-table,
    .users-table tbody,
    .users-table tr{
        width:100%;
        max-width:100%;
        overflow-x:hidden;
    }

    .users-table{
        table-layout:fixed;
        border-collapse:separate;
        border-spacing:0;
    }

    .users-table thead{
        display:none;
    }

    .users-table tbody{
        display:block;
    }

    .users-table tr{
        display:block;
        border:1px solid var(--border);
        border-radius:16px;
        padding:16px;
        margin-bottom:16px;
        background:var(--bg-panel-2);
    }

    .users-table tr:last-child{
        margin-bottom:0;
    }

    .users-table td{
        display:block;
        width:100%;
        min-width:0;
        padding:10px 0;
        font-size:14px;
        word-break:break-word;
        overflow-wrap:anywhere;
        border-bottom:1px solid var(--border-soft);
    }

    .users-table td:last-child{
        border-bottom:none;
        padding-bottom:0;
    }

    .users-table td::before{
        display:block;
        font-weight:600;
        color:var(--text-muted);
        margin-bottom:6px;
    }

    .users-table td:nth-child(1)::before{content:"Name";}
    .users-table td:nth-child(2)::before{content:"E-Mail";}
    .users-table td:nth-child(3)::before{content:"Rolle";}
    .users-table td:nth-child(4)::before{content:"Status";}
    .users-table td:nth-child(5)::before{content:"Erstellt am";}
    .users-table td:nth-child(6)::before{content:"Aktionen";}

    .users-table td:nth-child(2){
        font-size:13px;
        line-height:1.35;
    }

    .users-actions{
        display:flex;
        flex-wrap:wrap;
        gap:8px;
        width:100%;
        margin-top:6px;
    }

    .users-actions button{
        width:auto;
        max-width:100%;
        padding:6px 12px;
        font-size:13px;
        border-radius:10px;
        white-space:nowrap;
        word-break:break-word;
        overflow-wrap:anywhere;
        flex:0 1 auto;
        background:var(--bg-panel);
        border:1px solid var(--border);
        color:var(--text-main);
    }

    .users-actions button:hover{
        background:var(--bg-panel-2);
    }
}

@media (max-width:768px){

    .users-actions{
        display:flex;
        flex-wrap:wrap;
        gap:8px;
        margin-top:8px;
        width:100%;
    }

    .users-actions button{
        flex:1 1 auto;
        max-width:48%;
        padding:6px 10px;
        font-size:13px;
        border-radius:10px;
        white-space:nowrap;
    }

}