:root{
  --bg:#0b1020;
  --card:#121a33;
  --card2:#0f1630;
  --text:#e7eaf3;
  --muted:#aab3d3;
  --line:#25305a;
  --accent:#5aa2ff;
  --ok:#35d07f;
  --warn:#ffd479;
  --bad:#ff5a6b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:var(--sans);
  background: radial-gradient(1200px 700px at 25% 10%, #1a2550 0%, var(--bg) 55%);
  color:var(--text);
}
a{color:var(--accent); text-decoration:none;}
a:hover{text-decoration:underline;}
.container{max-width:1100px; margin:0 auto; padding:20px;}
.nav{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border:1px solid var(--line); border-radius:14px;
  background: linear-gradient(180deg, rgba(18,26,51,.85), rgba(15,22,48,.75));
  backdrop-filter: blur(8px);
}
.brand{display:flex; gap:12px; align-items:center;}
.brand .logo{
  width:34px; height:34px; border-radius:10px;
  background: linear-gradient(135deg, #5aa2ff, #8a5aff);
  box-shadow: 0 10px 24px rgba(90,162,255,.15);
}
.brand .title{font-weight:700; letter-spacing:.2px;}
.nav .links{display:flex; gap:14px; flex-wrap:wrap; align-items:center;}
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-size:12px;
  color:var(--muted);
}
.badge.pri{border-color:rgba(90,162,255,.35);}
.badge.status{border-color:rgba(170,179,211,.35);}
.badge.critical{border-color:rgba(255,90,107,.55); color:#ffd4d9; background: rgba(255,90,107,.08);}
.dot{display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--warn); margin-left:8px;}

.card{
  border:1px solid var(--line);
  background: rgba(18,26,51,.8);
  border-radius:16px;
  padding:18px;
  margin-top:16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}
.hr{height:1px; background:var(--line); margin:14px 0;}
.muted{color:var(--muted);}

.grid{display:grid; gap:14px;}
.grid-2{grid-template-columns: 1.15fr .85fr;}
@media (max-width: 920px){
  .grid-2{grid-template-columns: 1fr;}
}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
  text-decoration:none;
  font-weight:600;
}
.btn.primary{background: linear-gradient(180deg, rgba(90,162,255,.35), rgba(90,162,255,.12)); border-color: rgba(90,162,255,.55);}
.btn.ok{background: linear-gradient(180deg, rgba(53,208,127,.35), rgba(53,208,127,.12)); border-color: rgba(53,208,127,.55);}
.btn.danger{background: linear-gradient(180deg, rgba(255,90,107,.35), rgba(255,90,107,.12)); border-color: rgba(255,90,107,.55);}
.btn.link{background: transparent;}
.btn:hover{filter: brightness(1.08); text-decoration:none;}

input, select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(15,22,48,.65);
  color: var(--text);
  outline:none;
}
textarea{min-height:120px; resize: vertical;}
label{display:block; font-size:13px; color:var(--muted); margin:10px 0 6px;}
small{display:block; color:var(--muted); margin-top:6px; font-size:12px;}

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius:14px;
}
.table th, .table td{
  text-align:left;
  padding:12px 10px;
  border-bottom:1px solid var(--line);
}
.table th{font-size:12px; color:var(--muted); font-weight:700;}
.table tr:hover td{background: rgba(255,255,255,.02);}

.flash{margin-top:14px;}
.flash .item{
  padding:10px 12px; border-radius:12px; border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  margin-bottom:10px;
}
.flash .success{border-color: rgba(53,208,127,.55); background: rgba(53,208,127,.07);}
.flash .error{border-color: rgba(255,90,107,.55); background: rgba(255,90,107,.07);}

.kv{display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px;}
.kv .item{padding:12px; border-radius:14px; border:1px solid var(--line); background: rgba(255,255,255,.02);}
.kv .k{font-size:12px; color:var(--muted);}
.kv .v{font-size:16px; font-weight:700; margin-top:6px;}
@media (max-width: 640px){
  .kv{grid-template-columns: 1fr;}
}

.thread{display:flex; flex-direction:column; gap:10px; max-height:540px; overflow:auto; padding-right:6px;}
.msg{border:1px solid var(--line); border-radius:14px; padding:12px; background: rgba(255,255,255,.02);}
.msg .meta{display:flex; justify-content:space-between; gap:10px; font-size:12px; color:var(--muted); margin-bottom:8px;}
.msg .body{white-space: pre-wrap; line-height:1.55;}
.msg.admin{border-color: rgba(90,162,255,.55); background: rgba(90,162,255,.07);}
.msg.customer{border-color: rgba(170,179,211,.35);}
.code{font-family:var(--mono); font-size:12px; padding:10px; border-radius:12px; background: rgba(0,0,0,.35); border:1px solid var(--line); overflow:auto;}
