:root{
    --bg:#090d16;
    --panel:#101522;
    --panel2:#151b2a;
    --line:#283047;
    --text:#f4f6fb;
    --muted:#8e98ad;
    --accent:#8b6cf6;
    --green:#5dd18d;
    --orange:#dba953;
    --red:#e16a75;
}

*{box-sizing:border-box}

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

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

button,input,textarea,select{
    font:inherit;
}

.container{
    width:min(1180px,calc(100% - 40px));
    margin:auto;
}

.topbar{
    position:sticky;
    top:0;
    z-index:50;
    border-bottom:1px solid var(--line);
    background:rgba(9,13,22,.92);
    backdrop-filter:blur(14px);
}

.nav{
    min-height:68px;
    display:flex;
    align-items:center;
    gap:24px;
}

.brand{
    font-size:18px;
    font-weight:800;
}

.brand span{
    color:var(--accent);
}

.navlinks{
    display:flex;
    align-items:center;
    gap:6px;
    margin-left:20px;
}

.navlinks a{
    padding:9px 11px;
    border-radius:9px;
    color:var(--muted);
    font-size:13px;
}

.navlinks a:hover{
    background:var(--panel);
    color:white;
}

.nav-user{
    margin-left:auto;
    display:flex;
    align-items:center;
    gap:10px;
}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    padding:0 15px;
    border:1px solid var(--line);
    border-radius:10px;
    background:var(--panel2);
    color:white;
    cursor:pointer;
}

.btn:hover{
    border-color:#404a65;
}

.btn.primary{
    border-color:transparent;
    background:var(--accent);
    font-weight:700;
}

.btn.danger{
    color:#ff9ca5;
}

main{
    padding:42px 0 70px;
}

.hero{
    padding:48px 0 36px;
    text-align:center;
}

.hero h1{
    margin:0;
    font-size:clamp(32px,5vw,52px);
}

.hero p{
    max-width:650px;
    margin:13px auto 0;
    color:var(--muted);
    line-height:1.6;
}

.search{
    max-width:680px;
    margin:28px auto 0;
    display:flex;
    gap:10px;
}

.search input{
    flex:1;
}

input,textarea,select{
    width:100%;
    border:1px solid var(--line);
    border-radius:10px;
    background:#0d121d;
    color:white;
    padding:12px 13px;
    outline:none;
}

textarea{
    resize:vertical;
    min-height:150px;
}

input:focus,textarea:focus,select:focus{
    border-color:var(--accent);
}

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

.card{
    border:1px solid var(--line);
    border-radius:15px;
    background:var(--panel);
    padding:20px;
}

.card:hover{
    border-color:#3a455f;
}

.card h3{
    margin:0 0 8px;
    font-size:15px;
}

.card p{
    margin:0;
    color:var(--muted);
    font-size:12px;
    line-height:1.55;
}

.card .category{
    display:inline-flex;
    margin-bottom:13px;
    font-size:9px;
    color:#ae9cf9;
    text-transform:uppercase;
    letter-spacing:.08em;
}

.section-head{
    margin:38px 0 16px;
    display:flex;
    align-items:end;
    justify-content:space-between;
    gap:20px;
}

.section-head h1,
.section-head h2{
    margin:0;
}

.section-head p{
    margin:6px 0 0;
    color:var(--muted);
    font-size:12px;
}

.panel{
    border:1px solid var(--line);
    border-radius:16px;
    background:var(--panel);
    overflow:hidden;
}

.panel-head{
    padding:18px 20px;
    border-bottom:1px solid var(--line);
}

.panel-body{
    padding:20px;
}

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

.field{
    margin-bottom:17px;
}

.field label{
    display:block;
    margin-bottom:7px;
    font-size:12px;
    font-weight:700;
}

.field small{
    color:var(--muted);
}

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

.flash{
    margin-bottom:16px;
    padding:12px 14px;
    border:1px solid var(--line);
    border-radius:10px;
    background:var(--panel);
    font-size:12px;
}

.flash.error{
    border-color:rgba(225,106,117,.5);
}

.flash.success{
    border-color:rgba(93,209,141,.5);
}

.ticket-list{
    display:grid;
    gap:10px;
}

.ticket-row{
    display:grid;
    grid-template-columns:120px minmax(0,1fr) 140px 120px;
    gap:16px;
    align-items:center;
    padding:15px 18px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--panel);
}

.ticket-row:hover{
    border-color:#404b66;
}

.ticket-row strong{
    font-size:12px;
}

.ticket-row small{
    color:var(--muted);
}

.badge{
    display:inline-flex;
    width:max-content;
    padding:5px 8px;
    border:1px solid var(--line);
    border-radius:999px;
    font-size:9px;
}

.badge.open{border-color:#587fc5}
.badge.pending{border-color:#bd9040}
.badge.resolved{border-color:#3f9460}
.badge.closed{opacity:.55}
.badge.urgent{border-color:#ad4650;color:#ff9ba4}

.ticket-layout{
    display:grid;
    grid-template-columns:minmax(0,1fr) 320px;
    gap:18px;
    align-items:start;
}

.messages{
    display:grid;
    gap:12px;
}

.message{
    padding:16px;
    border:1px solid var(--line);
    border-radius:13px;
    background:var(--panel);
}

.message.agent{
    border-color:#4c4373;
}

.message-head{
    display:flex;
    justify-content:space-between;
    gap:20px;
    margin-bottom:10px;
}

.message-head span,
.message-head time{
    color:var(--muted);
    font-size:10px;
}

.message-body{
    white-space:pre-wrap;
    font-size:13px;
    line-height:1.6;
}

.sidebar{
    display:grid;
    gap:14px;
}

.info-list{
    display:grid;
}

.info-list>div{
    padding:12px 0;
    border-bottom:1px solid var(--line);
}

.info-list>div:last-child{
    border-bottom:0;
}

.info-list span{
    display:block;
    color:var(--muted);
    font-size:9px;
    text-transform:uppercase;
    margin-bottom:5px;
}

.info-list strong{
    font-size:11px;
}

.note{
    padding:13px;
    border:1px solid #6a5730;
    border-radius:10px;
    background:#1d1920;
    margin-bottom:9px;
}

.note small{
    display:block;
    color:var(--muted);
    margin-top:7px;
}

.stats{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:14px;
    margin-bottom:20px;
}

.stat{
    padding:20px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--panel);
}

.stat span{
    display:block;
    color:var(--muted);
    font-size:10px;
    text-transform:uppercase;
}

.stat strong{
    display:block;
    margin-top:7px;
    font-size:24px;
}

.status-list{
    display:grid;
    gap:12px;
}

.status-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:17px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--panel);
}

.status-item div{
    display:flex;
    align-items:center;
    gap:12px;
}

.dot{
    width:9px;
    height:9px;
    border-radius:50%;
    background:var(--green);
}

.article{
    max-width:820px;
}

.article-body{
    white-space:pre-wrap;
    line-height:1.8;
    color:#dce1ec;
}

footer{
    border-top:1px solid var(--line);
    padding:24px 0;
    color:var(--muted);
    font-size:11px;
}

@media(max-width:900px){
    .grid,
    .stats{
        grid-template-columns:repeat(2,1fr);
    }

    .ticket-layout{
        grid-template-columns:1fr;
    }

    .ticket-row{
        grid-template-columns:100px 1fr;
    }

    .ticket-row>*:nth-child(3),
    .ticket-row>*:nth-child(4){
        display:none;
    }
}

@media(max-width:650px){
    .container{
        width:min(100% - 24px,1180px);
    }

    .navlinks{
        display:none;
    }

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

    .search{
        flex-direction:column;
    }
}

.detected-category{
    min-height:45px;
    display:flex;
    align-items:center;
    padding:0 13px;

    border:1px solid var(--line);
    border-radius:10px;

    background:#0d121d;
    color:var(--muted);

    font-size:12px;
}

.detected-category.active{
    color:#fff;
    border-color:#49415f;
    background:#151827;
}

.detected-category{
    min-height:45px;
    display:flex;
    align-items:center;
    padding:0 13px;

    border:1px solid var(--line);
    border-radius:10px;

    background:#0d121d;
    color:var(--muted);

    font-size:12px;
}

.detected-category.active{
    color:#fff;
    border-color:#4b426c;
    background:#151827;
}
