:root{
    --bg:#f4f3f1;
    --card:#ffffff;
    --ink:#151515;
    --muted:#77746f;
    --line:#e8e5e1;
    --accent:#111111;
    --soft:#eeece8;
    --success:#27854a;
    --danger:#bd4b4b;
    --radius:24px;
}

*{box-sizing:border-box}

html,body{
    margin:0;
    min-height:100%;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Arial,sans-serif;
    background:var(--bg);
    color:var(--ink);
}

body{min-height:100vh}

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

button,input,select{font:inherit}

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

.sidebar{
    position:fixed;
    inset:0 auto 0 0;
    width:260px;
    padding:30px 22px 24px;
    background:#111;
    color:white;
    display:flex;
    flex-direction:column;
    z-index:20;
}

.brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:4px 8px 34px;
}

.brand-mark{
    width:42px;
    height:42px;
    display:grid;
    place-items:center;
    border:1px solid #555;
    border-radius:50%;
    font-family:Georgia,serif;
    font-size:24px;
}

.brand-name{
    letter-spacing:.18em;
    font-weight:650;
    font-size:14px;
}

.brand-sub{
    margin-top:4px;
    color:#8e8e8e;
    font-size:9px;
    letter-spacing:.22em;
}

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

nav a{
    padding:13px 14px;
    border-radius:12px;
    color:#aaa;
    transition:.2s;
}

nav a:hover,
nav a.active{
    background:#202020;
    color:white;
}

.sidebar-bottom{
    margin-top:auto;
}

.user-box{
    display:flex;
    align-items:center;
    gap:11px;
    margin-bottom:14px;
}

.avatar{
    width:38px;
    height:38px;
    display:grid;
    place-items:center;
    border-radius:50%;
    background:#2b2b2b;
    font-weight:700;
}

.user-meta{
    display:flex;
    flex-direction:column;
    min-width:0;
}

.user-meta strong{
    font-size:13px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.user-meta span{
    color:#888;
    font-size:11px;
    margin-top:3px;
}

.logout{
    width:100%;
    background:transparent;
    color:#888;
    border:1px solid #303030;
    border-radius:11px;
    padding:10px;
    cursor:pointer;
}

.logout:hover{
    color:white;
    border-color:#555;
}

.main{
    margin-left:260px;
    width:calc(100% - 260px);
    padding:54px;
}

.main-auth{
    width:100%;
}

.page-head{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:30px;
    margin-bottom:38px;
}

.eyebrow{
    color:#8a8680;
    font-size:11px;
    letter-spacing:.2em;
    font-weight:700;
    margin-bottom:10px;
}

.page-head h1{
    margin:0;
    font-family:Georgia,"Times New Roman",serif;
    font-size:48px;
    font-weight:400;
    letter-spacing:-.04em;
}

.page-head p{
    margin:10px 0 0;
    color:var(--muted);
}

.summary{
    background:#ece9e5;
    border-radius:18px;
    padding:14px 18px;
    display:flex;
    align-items:center;
    gap:9px;
    color:#777;
    font-size:13px;
}

.summary-number{
    font-size:22px;
    color:#111;
    font-weight:700;
}

.service-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
    gap:18px;
}

.service-card{
    background:var(--card);
    border:1px solid var(--line);
    border-radius:var(--radius);
    padding:26px;
    min-height:285px;
    display:flex;
    flex-direction:column;
    box-shadow:0 8px 30px rgba(0,0,0,.025);
    transition:transform .18s ease, box-shadow .18s ease;
}

.service-card:hover{
    transform:translateY(-2px);
    box-shadow:0 15px 40px rgba(0,0,0,.055);
}

.service-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:32px;
}

.service-icon{
    width:48px;
    height:48px;
    border-radius:16px;
    background:#161616;
    color:white;
    display:grid;
    place-items:center;
    font-size:13px;
    font-weight:800;
}

.status{
    display:flex;
    align-items:center;
    gap:7px;
    font-size:12px;
    color:#777;
}

.status span{
    width:8px;
    height:8px;
    border-radius:50%;
}

.status.online span{
    background:#43a864;
    box-shadow:0 0 0 5px rgba(67,168,100,.10);
}

.status.offline span{
    background:#c25b5b;
}

.service-group{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.14em;
    color:#9a958e;
    margin-bottom:7px;
}

.service-card h2{
    font-size:22px;
    margin:0 0 9px;
}

.service-card p{
    color:var(--muted);
    font-size:14px;
    line-height:1.5;
    margin:0;
    max-width:390px;
}

.service-footer{
    margin-top:auto;
    padding-top:25px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}

.port{
    color:#aaa;
    font-size:11px;
    font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
}

.open-button{
    padding:10px 14px;
    border-radius:12px;
    background:#f1efec;
    font-size:13px;
    font-weight:650;
}

.open-button span{margin-left:8px}

.open-button:hover{
    background:#111;
    color:white;
}

.panel{
    background:white;
    border:1px solid var(--line);
    border-radius:22px;
    padding:26px;
}

.panel h2{
    margin:0 0 22px;
    font-size:18px;
}

.admin-layout{
    display:grid;
    grid-template-columns:minmax(300px,.8fr) minmax(420px,1.2fr);
    gap:18px;
    align-items:start;
}

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

.form-grid label,
.login-form label{
    display:flex;
    flex-direction:column;
    gap:7px;
    color:#777;
    font-size:12px;
}

.full{grid-column:1/-1}

.field-title{
    color:#777;
    font-size:12px;
    margin-bottom:9px;
}

input,select{
    width:100%;
    border:1px solid #dedbd6;
    background:#fbfaf9;
    border-radius:12px;
    padding:12px 13px;
    outline:none;
    color:#171717;
}

input:focus,select:focus{
    border-color:#999;
    background:white;
}

.primary,.secondary,.ghost{
    border:0;
    border-radius:12px;
    padding:11px 15px;
    cursor:pointer;
    font-weight:650;
}

.primary{
    background:#111;
    color:white;
}

.secondary{
    background:#ece9e5;
    color:#222;
}

.ghost{
    background:transparent;
    border:1px solid #dedbd6;
}

.wide{width:100%}

.check-grid{
    display:grid;
    gap:8px;
}

.check{
    display:flex!important;
    flex-direction:row!important;
    align-items:center;
    gap:9px!important;
    padding:10px 12px;
    border:1px solid #ebe8e4;
    border-radius:11px;
    color:#444!important;
}

.check input{
    width:auto;
    margin:0;
}

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

.user-row{
    border:1px solid #ece9e5;
    border-radius:16px;
    padding:16px;
}

.user-row-head{
    display:flex;
    justify-content:space-between;
    gap:15px;
    margin-bottom:14px;
}

.user-row-head div:first-child{
    display:flex;
    flex-direction:column;
}

.user-row-head span{
    font-size:12px;
    color:#999;
    margin-top:3px;
}

.badge{
    align-self:flex-start;
    background:#f0eeeb;
    border-radius:999px;
    padding:6px 9px;
    font-size:10px;
    font-weight:700;
}

.user-settings{
    display:grid;
    gap:10px;
}

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

.toggle{
    display:flex;
    align-items:center;
    gap:8px;
    color:#666;
    font-size:12px;
}

.toggle input{width:auto}

.password-reset{
    margin-top:10px;
    display:grid;
    grid-template-columns:1fr auto;
    gap:8px;
}

.audit-panel{margin-top:18px}

.audit-list{
    display:flex;
    flex-direction:column;
}

.audit-row{
    display:grid;
    grid-template-columns:160px 110px 150px 1fr;
    gap:12px;
    padding:11px 0;
    border-top:1px solid #f0eeeb;
    font-size:12px;
    align-items:center;
}

.audit-date{
    color:#999;
    font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
}

.audit-row small{color:#999}

.login-wrap{
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:30px;
    background:
        radial-gradient(circle at 20% 10%,#fff 0,transparent 32%),
        radial-gradient(circle at 80% 85%,#e9e5df 0,transparent 36%),
        #f4f3f1;
}

.login-card{
    width:min(430px,100%);
    background:rgba(255,255,255,.86);
    border:1px solid rgba(255,255,255,.9);
    box-shadow:0 30px 90px rgba(0,0,0,.09);
    backdrop-filter:blur(18px);
    border-radius:30px;
    padding:42px;
}

.login-brand{
    text-align:center;
    letter-spacing:.28em;
    font-size:22px;
    font-weight:700;
}

.login-caption{
    text-align:center;
    color:#aaa;
    letter-spacing:.22em;
    font-size:9px;
    margin-top:6px;
}

.login-card h1{
    font-family:Georgia,"Times New Roman",serif;
    font-size:34px;
    font-weight:400;
    text-align:center;
    margin:42px 0 8px;
}

.login-card .muted{
    text-align:center;
    margin:0 0 28px;
}

.login-form{
    display:flex;
    flex-direction:column;
    gap:15px;
}

.muted{color:var(--muted)}

.secure-note{
    text-align:center;
    color:#bbb;
    font-size:10px;
    margin-top:20px;
    letter-spacing:.06em;
}

.flash{
    padding:12px 15px;
    border-radius:12px;
    margin-bottom:18px;
    font-size:13px;
}

.flash.success{background:#e8f5ec;color:#23693a}
.flash.error{background:#faeaea;color:#923d3d}
.flash.info{background:#efede9;color:#666}

.empty-state{
    background:white;
    border:1px solid var(--line);
    border-radius:20px;
    padding:35px;
    color:#777;
}

@media(max-width:900px){
    .sidebar{
        position:static;
        width:100%;
        min-height:auto;
    }

    .shell{display:block}

    .sidebar nav{
        flex-direction:row;
        overflow:auto;
    }

    .sidebar-bottom{margin-top:25px}

    .main{
        margin-left:0;
        width:100%;
        padding:28px 20px;
    }

    .page-head{
        align-items:flex-start;
        flex-direction:column;
    }

    .page-head h1{font-size:38px}

    .admin-layout{grid-template-columns:1fr}
    .audit-row{grid-template-columns:1fr}
}

@media(max-width:560px){
    .form-grid{grid-template-columns:1fr}
    .full{grid-column:auto}
    .login-card{padding:30px 24px}
}
