:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --shadow: 0 10px 25px rgba(17,24,39,.06);
  --shadow2: 0 6px 14px rgba(17,24,39,.08);
  --primary:#2563eb;
  --primary2:#1d4ed8;
  --danger:#dc2626;
  --danger2:#b91c1c;
  --chip:#eef2ff;
  --warn:#fff7ed;
  --warnLine:#fed7aa;
  --radius:18px;
  --radius2:14px;
}

*{ 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;
  color:var(--text);
  background: radial-gradient(1200px 500px at 20% -10%, rgba(37,99,235,.12), transparent 60%),
              radial-gradient(900px 480px at 90% 0%, rgba(99,102,241,.12), transparent 55%),
              var(--bg);
}

.hidden{ display:none !important; }

code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:.95em;
  background:#f3f4f6;
  padding:.12em .35em;
  border-radius:10px;
}

.app{ min-height:100%; }

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  gap:16px;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  background: rgba(246,247,251,.78);
  backdrop-filter: blur(10px);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:240px;
}

.logo{
  width:42px;
  height:42px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:white;
  font-weight:800;
  letter-spacing:.5px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  box-shadow: var(--shadow2);
}

.brandText{ display:flex; flex-direction:column; line-height:1.05; }
.brandName{ font-weight:800; font-size:18px; }
.brandTag{ color:var(--muted); font-size:12px; margin-top:3px; }

.topbarCenter{
  flex:1;
  display:flex;
  gap:12px;
  align-items:center;
  min-width:320px;
}

.searchWrap{
  flex:1;
  display:flex;
  gap:10px;
  align-items:center;
}

.filters{
  display:flex;
  gap:10px;
  align-items:center;
}

.topbarRight{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  min-width:420px;
}

.input,.select,.textarea{
  width:100%;
  border:1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 14px;
  padding:10px 12px;
  outline:none;
  transition: box-shadow .12s ease, border-color .12s ease;
}

.textarea{
  resize: vertical;
  min-height:120px;
}

.input:focus,.select:focus,.textarea:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.btn{
  border:1px solid var(--line);
  background: white;
  padding:10px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight:700;
  transition: transform .08s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{ box-shadow: var(--shadow2); }
.btn:active{ transform: translateY(1px); }

.btnPrimary{
  background: var(--primary);
  border-color: rgba(37,99,235,.25);
  color:white;
}
.btnPrimary:hover{ background: var(--primary2); }

.btnDanger{
  background: var(--danger);
  border-color: rgba(220,38,38,.25);
  color:white;
}
.btnDanger:hover{ background: var(--danger2); }

.btnGhost{
  background: transparent;
}

.iconBtn{
  border:none;
  background: transparent;
  font-size: 22px;
  font-weight:900;
  cursor:pointer;
  padding:6px 10px;
  border-radius:12px;
}
.iconBtn:hover{ background: rgba(17,24,39,.06); }

.onlinePill{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius: 999px;
  background: white;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.onlinePill .dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.15);
}

.main{
  display:flex;
  gap:16px;
  padding:16px;
  max-width: 1200px;
  margin: 0 auto;
}

.leftRail{
  width: 260px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.content{
  flex:1;
  min-width: 0;
}

.card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.smallCard{ padding:12px; }

.navCard{
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.navLink{
  text-decoration:none;
  color: var(--text);
  font-weight:800;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid transparent;
}
.navLink:hover{ background: rgba(37,99,235,.06); }
.navLink.active{
  background: rgba(37,99,235,.10);
  border-color: rgba(37,99,235,.20);
}

.navHint{
  margin-top:6px;
  padding:10px 12px;
  border-radius: 14px;
  background: rgba(17,24,39,.03);
  border:1px dashed rgba(17,24,39,.10);
}
.hintTitle{ font-weight:900; font-size:13px; }
.hintText{ color: var(--muted); font-size:12px; margin-top:4px; }

.view{ padding-bottom: 40px; }
.viewHeader{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.h1{ font-size: 26px; margin:0; font-weight:900; letter-spacing:-.3px; }
.h2{ font-size: 20px; margin:0; font-weight:900; letter-spacing:-.2px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }

.statusRow{
  min-height: 18px;
  margin: 8px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.posts{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.postCard{
  padding:14px;
  border-radius: var(--radius);
  border:1px solid var(--line);
  background:white;
  box-shadow: var(--shadow);
}
.postTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}
.postTitle{
  font-size: 18px;
  margin:0;
  font-weight:900;
}
.postMeta{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:6px;
  font-size: 12px;
  color: var(--muted);
}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius: 999px;
  border:1px solid rgba(17,24,39,.08);
  background: rgba(17,24,39,.03);
  font-weight:800;
  color: #111827;
}
.badge.news{ background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.18); }
.badge.post{ background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.18); }

.postContent{
  margin-top:10px;
  white-space: pre-wrap;
  line-height:1.45;
  color:#111827;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.chip{
  background: var(--chip);
  border:1px solid rgba(99,102,241,.22);
  color:#3730a3;
  padding:4px 10px;
  border-radius:999px;
  font-weight:800;
  font-size: 12px;
}

.postActions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid var(--line);
}
.actionLeft{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.counter{
  font-weight:800;
  color: var(--muted);
  font-size: 13px;
}
.likeBtn.liked{
  border-color: rgba(37,99,235,.35);
  background: rgba(37,99,235,.08);
}

.postOwnerActions{
  display:flex;
  gap:8px;
  align-items:center;
}

.commentsWrap{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid var(--line);
  display:none;
}
.commentsWrap.open{ display:block; }

.comment{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(17,24,39,.02);
  margin-top:8px;
}
.commentMeta{
  font-size: 12px;
  color: var(--muted);
  display:flex;
  gap:10px;
  align-items:center;
}
.commentText{
  margin-top:6px;
  white-space: pre-wrap;
  line-height:1.4;
}

.commentForm{
  display:flex;
  gap:10px;
  margin-top:10px;
}
.commentForm .input{ flex:1; }

.loadMoreRow{
  margin-top: 14px;
  display:flex;
  justify-content:center;
}

.formCard{ padding:14px; }
.formRow{ margin-top:12px; }
.formRow:first-child{ margin-top:0; }

.label{
  display:block;
  font-weight:900;
  font-size: 12px;
  color:#111827;
  margin-bottom:6px;
}
.help{
  color: var(--muted);
  font-size: 12px;
  margin-top:6px;
}

.formActions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:14px;
}
.formMsg{ color: var(--muted); font-size: 13px; }

.warningCard{
  background: var(--warn);
  border-color: var(--warnLine);
}

.profileTop{
  display:flex;
  gap:12px;
  align-items:center;
}
.avatar{
  width:48px;
  height:48px;
  border-radius: 18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:white;
  background: linear-gradient(135deg, #10b981, #2563eb);
  box-shadow: var(--shadow2);
}
.profileName{
  font-size: 20px;
  font-weight:900;
}
.profileBio{
  margin-top:10px;
  white-space: pre-wrap;
  line-height:1.45;
}
.sep{ opacity:.6; padding:0 2px; }

.bullets{
  margin:10px 0 0;
  padding-left:18px;
  color: var(--muted);
  font-size: 13px;
}
.cardTitle{
  font-weight:900;
  margin:0;
  font-size: 14px;
}

.modal{
  position:fixed;
  inset:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.modalOverlay{
  position:absolute;
  inset:0;
  background: rgba(17,24,39,.45);
}
.modalBody{
  position:relative;
  width: min(720px, 96vw);
  background: white;
  border:1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(17,24,39,.25);
  padding:14px;
}
.modalHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:6px 6px 10px;
  border-bottom:1px solid var(--line);
}

.tabs{
  display:flex;
  gap:8px;
  margin-top:12px;
}
.tab{
  flex:1;
  border:1px solid var(--line);
  background: rgba(17,24,39,.02);
  border-radius: 14px;
  padding:10px 12px;
  font-weight:900;
  cursor:pointer;
}
.tab.active{
  background: rgba(37,99,235,.10);
  border-color: rgba(37,99,235,.22);
}

.modalForm{ margin-top:12px; }

.checkRow{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:10px;
  color: var(--muted);
  font-size: 13px;
  user-select:none;
}

.adminGrid{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
}
.adminTile{ padding:12px; }
.tileLabel{ color: var(--muted); font-size: 12px; font-weight:800; }
.tileValue{ font-size: 22px; font-weight:900; margin-top:6px; }

.adminLists{
  margin-top:10px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.list{ margin-top:8px; display:flex; flex-direction:column; gap:8px; }
.listItem{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(17,24,39,.02);
}
.listLeft{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.listTitle{ font-weight:900; }
.listSub{ color: var(--muted); font-size: 12px; }

@media (max-width: 980px){
  .topbar{ flex-wrap:wrap; position:static; }
  .brand{ min-width: auto; }
  .topbarRight{ min-width:auto; flex-wrap:wrap; justify-content:flex-start; }
  .main{ flex-direction:column; }
  .leftRail{ width:auto; }
  .adminGrid{ grid-template-columns: 1fr 1fr; }
  .adminLists{ grid-template-columns: 1fr; }
}

@media (max-width: 520px){
  .filters{ flex-wrap:wrap; }
  .searchWrap{ flex-direction:column; align-items:stretch; }
  .topbarCenter{ flex-direction:column; align-items:stretch; }
  .postTop{ flex-direction:column; }
  .postActions{ flex-direction:column; align-items:stretch; }
  .postOwnerActions{ justify-content:flex-end; }
}
