:root{
  --bg:#0b1220;
  --card:#101a30;
  --muted:#8ea0c1;
  --text:#e9f0ff;
  --accent:#4da3ff;
  --accent2:#7c5cff;
  --danger:#ff5c7a;
  --border:rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius:18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(1200px 600px at 10% 0%, rgba(77,163,255,.22), transparent 60%),
              radial-gradient(1000px 600px at 90% 10%, rgba(124,92,255,.22), transparent 60%),
              var(--bg);
  color:var(--text);
}

a{color:inherit; text-decoration:none}
.container{max-width:1020px; margin:0 auto; padding:22px}
.navbar{
  display:flex; align-items:center; justify-content:space-between;
  background: rgba(16,26,48,.55);
  border:1px solid var(--border);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding:14px 16px;
  box-shadow: var(--shadow);
}
.brand{display:flex; align-items:center; gap:12px; font-weight:700; letter-spacing:.2px}
.brand .logo{
  width:40px; height:40px; border-radius:14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display:grid; place-items:center;
  box-shadow: 0 12px 28px rgba(77,163,255,.18);
}
.brand .logo svg{filter: drop-shadow(0 6px 10px rgba(0,0,0,.25))}
.nav-actions{display:flex; gap:10px; align-items:center}

.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--muted);
  background: rgba(255,255,255,.03);
}

.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  border:none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 14px 30px rgba(77,163,255,.18);
}
.btn.danger{
  border:none;
  background: linear-gradient(135deg, var(--danger), #ff9966);
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:16px;
  margin-top:18px;
}

.card{
  background: rgba(16,26,48,.60);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow:hidden;
}
.card-header{
  padding:16px 18px;
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.card-header h1, .card-header h2{margin:0; font-size:18px}
.card-body{padding:18px}
.muted{color:var(--muted)}

.form{
  display:grid;
  gap:12px;
}
.field{display:grid; gap:8px}
label{font-size:13px; color:var(--muted)}
input, textarea{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
}
textarea{min-height:140px; resize:vertical}
input:focus, textarea:focus{border-color: rgba(77,163,255,.45)}
.help{
  font-size:12px; color:var(--muted);
}

.alert{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,92,122,.35);
  background: rgba(255,92,122,.12);
  color:#ffd9e0;
}

.channel{
  display:grid; gap:14px;
}
.post{
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  padding:14px 14px 12px;
}
.post-top{
  display:flex; justify-content:space-between; align-items:flex-start; gap:10px;
  margin-bottom:8px;
}
.post-title{
  margin:0; font-size:16px; line-height:1.25;
}
.post-meta{
  font-size:12px; color:var(--muted);
  display:flex; gap:8px; align-items:center; flex-wrap:wrap;
}
.pill{
  font-size:11px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  color:var(--muted);
}
.post-content{
  margin:0;
  white-space: pre-wrap;
  line-height:1.45;
}
.footer{
  margin-top:20px;
  font-size:12px;
  color:var(--muted);
  text-align:center;
}

.kbd{
  font-family:var(--mono);
  font-size:11px;
  padding:2px 6px;
  border-radius:8px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  color:var(--muted);
}

@media (min-width: 900px){
  .grid.two{grid-template-columns: 1.05fr .95fr}
}


/* mobile tweaks */
@media (max-width: 560px){
  .container{padding:14px}
  .navbar{flex-direction:column; align-items:flex-start; gap:12px}
  .nav-actions{width:100%; flex-wrap:wrap}
  .btn{padding:10px 12px}
  .badge{width:100%; display:flex; justify-content:space-between; gap:10px}
  .card-header{flex-direction:column; align-items:flex-start}
  .post-top{flex-direction:column; align-items:flex-start}
  .post-top > div:last-child{align-self:flex-end}
  input, textarea{border-radius:12px}
}

.dot{
  width:10px; height:10px; border-radius:999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 18px rgba(77,163,255,.22);
  flex: 0 0 auto;
}
.pill-new{
  border:none;
  background: rgba(77,163,255,.16);
  color:#d8ecff;
}
.is-read{opacity:.92}
.server-list{display:grid; gap:10px}
.server-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.server-name{font-weight:600; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.status{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  white-space:nowrap;
}
.status.ok{border-color: rgba(90,255,170,.25); background: rgba(90,255,170,.10); color:#d7ffe8}
.status.bad{border-color: rgba(255,92,122,.35); background: rgba(255,92,122,.12); color:#ffd9e0}

.pill-online{border-color: rgba(255,255,255,.12); color: var(--muted);}
.pill-online.on{border-color: rgba(90,255,170,.25); background: rgba(90,255,170,.10); color:#d7ffe8;}

.kv{margin-top:12px; display:grid; gap:10px}
.kv-row{display:grid; gap:8px}
.kv-key{font-size:12px; color:var(--muted)}
.kv-val code.codebreak{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  word-break: break-all;
  white-space: pre-wrap;
}


.pin-ico{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px; height:22px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
}
.pin-ico svg{width:14px;height:14px;opacity:.95}
.md-pre{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  overflow:auto;
}
.md-code{
  padding:2px 6px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .95em;
}
.md-quote{
  margin:8px 0;
  padding:10px 12px;
  border-left:3px solid rgba(77,163,255,.55);
  background: rgba(77,163,255,.08);
  border-radius:10px;
}
.toolbar{
  display:flex; gap:8px; flex-wrap:wrap;
  margin-top:10px;
}
.toolbar .btn{padding:8px 10px}

/* Links highlighted */
.post-content a, .kv a, .md-quote a{
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(77,163,255,.35);
}
.post-content a:hover, .kv a:hover, .md-quote a:hover{
  border-bottom-color: rgba(77,163,255,.75);
}

/* Editor context menu (Telegram-like) */
.ctx-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.ctx-item:hover{
  background: rgba(255,255,255,.06);
}
.ctx-sep{
  height: 1px;
  background: rgba(255,255,255,.08);
}
.ctx-kbd{
  margin-left:auto;
  font-size: 11px;
  color: var(--muted);
}

/* --- v16 Dark redesign overrides --- */

:root{
  --bg0:#080b14;
  --bg1:#0b1020;
  --card: rgba(255,255,255,.035);
  --border: rgba(255,255,255,.085);
  --text:#eaf0ff;
  --muted: rgba(234,240,255,.62);
  --accent:#6aa9ff;
  --danger:#ff5c7a;
  --radius:18px;
}
body{
  background:
    radial-gradient(900px 700px at 15% -10%, rgba(106,169,255,.18), transparent 60%),
    radial-gradient(800px 650px at 95% 10%, rgba(155,124,255,.14), transparent 55%),
    radial-gradient(900px 700px at 40% 110%, rgba(0,212,255,.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}
header{
  background: rgba(8,11,20,.62);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.card{
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 18px 55px rgba(0,0,0,.55);
}
.post{
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.09);
}
.post:hover{
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.13);
}
.post-content a{
  color: var(--accent);
  border-bottom: 1px solid rgba(106,169,255,.35);
  text-decoration:none;
}
.post-content a:hover{border-bottom-color: rgba(106,169,255,.75);}
.pin-ico{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:24px;height:24px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.logo{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
}

/* --- v17 cleanup: remove any old PIN leftovers --- */
.pill-pin, .pin-pill, .pin-badge{display:none !important;}

/* --- v17 compact posts + preview --- */

.card-header{padding:14px 14px 10px;}
.card-body{padding:12px 14px 14px;}
.channel{gap:10px;}
.post{padding:12px 12px 10px;border-radius:16px;}
.post-title{font-size:15px; line-height:1.15;}
.post-preview{
  margin-top:8px;
  color: rgba(234,240,255,.72);
  font-size: 13px;
  line-height: 1.45;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.post-meta{margin-top:8px; font-size:12px;}
.post-content{margin-top:12px; font-size:14px; line-height:1.6;}
