:root{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --brand: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
  --border: rgba(17,24,39,0.10);
  --shadow: 0 12px 30px rgba(17,24,39,0.08);
  --radius: 14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(16,185,129,0.12), transparent 45%),
    radial-gradient(1000px 700px at 90% 10%, rgba(59,130,246,0.10), transparent 45%),
    var(--bg);
  color: var(--text);
}

a{color:inherit; text-decoration:none}
.container{width:min(1100px, 92vw); margin:0 auto}

.nav{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(10px);
  background: rgba(246,247,251,0.75);
  border-bottom: 1px solid var(--border);
}

.nav-inner{display:flex; align-items:center; padding:12px 0; gap:12px}
.brand{
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(16,185,129,0.18), rgba(59,130,246,0.12));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight:800;
}
.nav-spacer{flex:1}
.nav-right{display:flex; align-items:center; gap:10px}
.nav-user{font-size: 13px; color: var(--muted); max-width: 160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  height:38px; padding:0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.85);
  color: var(--text);
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,1)}
.btn:active{transform: translateY(1px)}
.btn-ghost{background: transparent}
.btn-danger{border-color: rgba(239,68,68,0.35); color: #b91c1c}
.btn-danger:hover{background: rgba(239,68,68,0.08)}

.dropdown{position:relative}
.dropdown-menu{
  position:absolute; right:0; top:44px;
  min-width: 140px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow:hidden;
  box-shadow: var(--shadow);
  display:none;
}
.dropdown-menu.open{display:block}
.dropdown-item{display:block; padding:10px 12px; color: var(--text)}
.dropdown-item:hover{background: rgba(17,24,39,0.04)}

.flash-wrap{margin: 16px 0; display:grid; gap:10px}
.flash{padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.85); color: var(--text)}
.flash-warn{border-color: rgba(245,158,11,0.35)}
.flash-ok{border-color: rgba(16,185,129,0.35)}
.flash-err{border-color: rgba(239,68,68,0.35)}

.page-head{display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin: 24px 0 14px}
.page-title{font-size: 22px; font-weight: 800; letter-spacing: 0.2px}
.page-sub{font-size: 13px; color: var(--muted)}

.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.card{
  grid-column: span 12;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card:hover{border-color: rgba(17,24,39,0.16)}

.server-card{display:flex; gap:14px; align-items:stretch}
.server-badge{
  width: 54px; height: 54px; border-radius: 16px;
  background: radial-gradient(circle at 30% 25%, rgba(16,185,129,0.28), rgba(59,130,246,0.16));
  border: 1px solid var(--border);
  flex: 0 0 auto;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
.server-icon{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.server-main{flex:1; min-width: 0}
.server-name{font-weight:800; font-size:16px; margin:0 0 6px}
.server-desc{margin:0; font-size: 13px; color: var(--muted); line-height: 1.5}
.server-meta{display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; color: var(--muted); font-size: 12px}
.meta-pill{padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: rgba(17,24,39,0.03)}
.server-actions{display:flex; flex-direction:column; gap:8px; justify-content:space-between; align-items:flex-end}

@media (min-width: 700px){
  .card{grid-column: span 6}
}
@media (min-width: 980px){
  .card{grid-column: span 4}
}

.tabs{
  display:flex; gap:10px; flex-wrap:wrap;
  padding: 10px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 10px 0 18px;
}
.tab{padding: 8px 12px; border-radius: 12px; border: 1px solid transparent; color: var(--muted)}
.tab.active{color: var(--text); border-color: var(--border); background: rgba(17,24,39,0.03)}

.two-col{
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px){
  .two-col{grid-template-columns: 2fr 1fr}
}

.panel{
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.panel h2{margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 700; letter-spacing: 0.3px}

.kv{display:grid; grid-template-columns: 1fr; gap: 10px}
.kv-item{display:flex; justify-content:space-between; gap: 10px; font-size: 13px}
.kv-key{color: var(--muted)}

.form{display:grid; gap:10px}
.input, textarea{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.95);
  color: var(--text);
  outline:none;
}
textarea{min-height: 140px; resize: vertical}
.label{font-size: 12px; color: var(--muted)}
.row{display:flex; gap: 10px; align-items:center; flex-wrap:wrap}
.row-right{margin-left:auto}

.post{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.78);
}
.post-title{margin:0 0 6px; font-size: 16px; font-weight: 800}
.post-meta{font-size: 12px; color: var(--muted); display:flex; gap:10px; flex-wrap:wrap}
.post-body{margin: 10px 0 0; font-size: 13px; line-height: 1.65; color: rgba(17,24,39,0.92); white-space: pre-wrap}
.post-img{margin-top: 10px; width:100%; border-radius: 12px; border: 1px solid var(--border)}
.divider{height:1px; background: var(--border); margin: 12px 0}

.chat{
  display:flex;
  flex-direction:column;
  height: 64vh;
  min-height: 420px;
}
.chat-log{
  flex:1;
  overflow:auto;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(17,24,39,0.03);
}
.chat-item{margin:0 0 10px; font-size: 13px; line-height: 1.55}
.chat-item .who{color: var(--muted); margin-right: 6px}
.chat-item .msg{color: rgba(17,24,39,0.95)}
.chat-bar{display:flex; gap:10px; margin-top: 10px}
.chat-status{font-size: 12px; color: var(--muted)}

.small{font-size: 12px; color: var(--muted)}

.table{width:100%; border-collapse: collapse; font-size: 13px}
.table th, .table td{padding: 10px; border-bottom: 1px solid var(--border); text-align:left; vertical-align:top}
.table th{color: var(--muted); font-weight: 700}

.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
.pill{display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:999px; border:1px solid var(--border); background: rgba(17,24,39,0.03); color: var(--muted); font-size:12px}
.pill.ok{border-color: rgba(16,185,129,0.35); color: #047857}
.pill.warn{border-color: rgba(245,158,11,0.35); color: #92400e}
.pill.bad{border-color: rgba(239,68,68,0.35); color: #991b1b}

.chat-item.is-sys {
  opacity: 0.65;
  font-size: 12px;
}

.chat-item.is-sys .who {
  letter-spacing: 0.2px;
}