/* Kisroal - white full-width, rounded, classic forum */
:root {
  --bg: #ffffff;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e8e8e8;
  --line-strong: #d2d2d2;
  --soft: #f6f6f6;
  --link: #1a5f9e;
  --link-hover: #0f3f6b;
  --ok-bg: #f3faf4;
  --ok: #2f6b3f;
  --err-bg: #fff5f4;
  --err: #a13a2e;
  --pin: #9a5b32;
  --lock: #8a4b42;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --ui: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
.container { width: 100%; max-width: none; margin: 0; padding: 0 20px; }

.top-utility {
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--muted);
}
.top-utility .container {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.top-utility a { color: var(--muted); }
.top-utility a:hover { color: var(--ink); }
.top-utility .right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.inline-form button.linkish,
button.linkish {
  border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 0;
}
.inline-form button.linkish:hover { color: var(--ink); text-decoration: underline; }

.site-banner { padding: 18px 0; background: #fff; border-bottom: 1px solid var(--line); }
.site-banner .brand-wrap { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.brand { font-size: 28px; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.1; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand small { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.banner-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 2px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.stat-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; background: #fafafa; }
.stat-num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.admin-form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-form-row input[type=text], .admin-form-row input[type=number] { width: auto; min-width: 140px; flex: 1; }
.board-admin-list { display: grid; gap: 12px; padding: 14px; }
.board-admin-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.inline-move { display: inline-flex; gap: 6px; align-items: center; }
.inline-move select { border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 10px; font: inherit; background: #fff; }

.nav-bar { background: #fff; border-bottom: 1px solid var(--line); }
.nav-bar .container { display: flex; gap: 6px; min-height: 50px; align-items: center; flex-wrap: wrap; }
.nav-bar a {
  color: var(--ink); font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
}
.nav-bar a:hover { background: var(--soft); text-decoration: none; }
.nav-bar .search-box { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.nav-bar .search-box input {
  width: min(260px, 42vw); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 8px 14px; font: inherit; background: #fff;
}
.badge-dot {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #e24c3b; color: #fff;
  font-size: 11px; font-weight: 700; align-items: center; justify-content: center;
  margin-left: 4px;
}

.main { padding: 0; min-height: calc(100vh - 180px); }
.page-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 180px);
}
.page-main {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 18px 22px 32px;
  display: grid;
  gap: 16px;
  align-content: start;
}
.page-side {
  background: #fafafa;
  min-height: 100%;
  padding: 16px 14px;
  border-right: 0;
}

@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .page-main { border-left: 0; border-top: 1px solid var(--line); order: 2; }
  .page-side { order: 1; padding: 12px; }
  .nav-bar .search-box { width: 100%; margin-left: 0; }
  .nav-bar .search-box input { width: 100%; }
}

.breadcrumb { font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.notice, .alert {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: #fff;
}
.notice { color: #555; background: #fafafa; }
.alert-success { background: var(--ok-bg); border-color: #cfe3d4; color: var(--ok); }
.alert-error { background: var(--err-bg); border-color: #efcfc9; color: var(--err); }

.box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.box-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fff;
}
.box-hd > span:first-child { font-size: 15px; font-weight: 700; }
.box-hd .sub { color: var(--muted); font-size: 12px; }
.box-bd { background: #fff; }
.box-bd.pad { padding: 16px; }
.box-desc {
  border-bottom: 1px solid var(--line); background: #fafafa;
  color: var(--muted); font-size: 13px; padding: 12px 16px;
}
.right-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; }
.tabs a {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: none;
}
.tabs a.active, .tabs a:hover { background: #111; color: #fff; border-color: #111; text-decoration: none; }

.side-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: auto;
  overflow: hidden;
  background: #fff;
}
.side-panel .box-hd { border-radius: 0; background: #fff; }
.cat-list { list-style: none; margin: 0; padding: 8px; }
.cat-item { border-bottom: 0; margin-bottom: 4px; }
.cat-item a {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  padding: 12px 12px; color: var(--ink); text-decoration: none;
  border-radius: var(--radius-sm);
}
.cat-item a:hover { background: #f5f5f5; text-decoration: none; }
.cat-item .cat-name { font-weight: 700; font-size: 14px; }
.cat-item .cat-desc { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }
.cat-item .cat-count {
  color: var(--muted); font-size: 12px; min-width: 28px; text-align: center;
  background: #f3f3f3; border-radius: 999px; padding: 2px 8px; align-self: center;
}
.cat-item.active a { background: #f0f4f8; }
.cat-item.active .cat-name { color: var(--link); }
.cat-item.active .cat-count { background: #e4eef8; color: var(--link); }

.forum-table { width: 100%; border-collapse: collapse; }
.forum-table th, .forum-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
}
.forum-table th { font-size: 12px; color: var(--muted); background: #fafafa; font-weight: 700; }
.forum-table tr:last-child td { border-bottom: 0; }
.forum-table tr:hover td { background: #fcfcfc; }
.forum-table .col-author { width: 110px; }
.forum-table .col-stats { width: 64px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.forum-table .col-time { width: 120px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.forum-table .title-link { color: var(--ink); font-weight: 700; font-size: 15px; }
.forum-table .title-link:hover { color: var(--link); }
.forum-table .desc, .forum-table .meta { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.badge {
  display: inline-block; padding: 2px 10px; margin-right: 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; border: 1px solid var(--line); background: #fff;
}
.badge-pin { color: var(--pin); border-color: #e7d0bb; background: #fffaf6; }
.badge-lock { color: var(--lock); border-color: #e5c9c4; background: #fff8f7; }

.post {
  display: grid; grid-template-columns: 150px 1fr;
  border-bottom: 1px solid var(--line); min-height: 140px;
}
.post:last-child { border-bottom: 0; }
.post-side {
  padding: 16px 12px; background: #fafafa; border-right: 1px solid var(--line); text-align: center;
}
.post-side .name { display: block; font-weight: 700; color: var(--ink); margin-bottom: 10px; word-break: break-all; }
.post-side .avatar, .chip-avatar, img.avatar-img {
  width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%;
  border: 1px solid var(--line); background: #efefef; color: #555;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; object-fit: cover;
}
img.avatar-img { display: block; }
.post-side .side-meta { text-align: left; font-size: 12px; color: var(--muted); line-height: 1.7; padding: 0 4px; }
.post-main { background: #fff; }
.post-topline {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px;
}
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.post-title-bar { padding: 16px 16px 0; }
.post-title-bar h1 { margin: 0; font-size: 22px; line-height: 1.35; font-weight: 700; }
.post-content, .md-body {
  padding: 12px 16px 18px; line-height: 1.8; font-size: 15px; min-height: 80px;
}
.md-body pre, .md-body code {
  font-family: Consolas, "Courier New", monospace;
  background: #f5f5f5; border-radius: 8px;
}
.md-body pre { padding: 12px; overflow: auto; border: 1px solid var(--line); }
.md-body code { padding: 1px 5px; }
.md-body blockquote {
  margin: 0.6em 0; padding: 10px 14px; border-left: 3px solid #ccc; color: #555;
  background: #fafafa; border-radius: 0 10px 10px 0;
}
.md-body p { margin: 0.6em 0; }
.md-body img { max-width: 100%; border-radius: 10px; }

/* Markdown editor */
.md-composer { margin-bottom: 8px; }
.md-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px; border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: #fafafa;
}
.md-btn {
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; line-height: 1.2;
}
.md-btn:hover, .md-btn.active { background: #111; color: #fff; border-color: #111; }
.md-btn i { font-style: italic; font-weight: 700; }
.md-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 2px; }
.md-textarea {
  border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; min-height: 200px;
}
.md-preview {
  border: 1px solid var(--line-strong); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px 14px; min-height: 200px; background: #fff;
}
.md-body table { width: 100%; border-collapse: collapse; margin: 0.8em 0; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.md-body th { background: #fafafa; }
.md-body ul.contains-task-list { list-style: none; padding-left: 0.4em; }
.md-body .task-list-item input { margin-right: 8px; }
.md-body del { color: #777; }

.action-bar {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px;
  border-top: 1px solid var(--line); background: #fafafa;
}
.stats-row { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }

.form-wrap { width: min(560px, 100%); margin: 0 auto; }
.form-wrap.wide { width: 100%; }
.form-table { width: 100%; border-collapse: collapse; }
.form-table th, .form-table td { padding: 10px 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
.form-table tr:last-child th, .form-table tr:last-child td { border-bottom: 0; }
.form-table th { width: 96px; text-align: right; color: var(--muted); font-size: 13px; font-weight: 700; padding-top: 16px; }
label { font-weight: 700; color: #333; }
input[type=text], input[type=password], input[type=email], textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  border-radius: var(--radius-sm); padding: 11px 13px; font: inherit;
}
input:focus, textarea:focus { outline: none; border-color: #999; box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
textarea { min-height: 170px; resize: vertical; line-height: 1.7; }
.field-error { color: var(--err); font-size: 12px; margin-top: 6px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 14px; flex-wrap: wrap; }
.auth-links { margin-top: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 8px 15px; font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f5f5f5; color: var(--ink); text-decoration: none; }
.btn-primary { background: #222; border-color: #222; color: #fff; }
.btn-primary:hover { background: #000; border-color: #000; color: #fff; }
.btn-danger { background: #fff; border-color: #e0a8a1; color: var(--err); }
.btn-danger:hover { background: #fff5f4; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.active-like { background: #fff4ec; border-color: #e7c8ad; color: var(--pin); }

.pager {
  display: flex; justify-content: flex-end; gap: 8px; align-items: center; padding: 12px 16px;
  background: #fff; border-top: 1px solid var(--line);
}
.page-info { color: var(--muted); font-size: 13px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0 26px; background: #fff; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 14px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600;
  text-decoration: none; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff;
}
.user-chip:hover { color: var(--ink); text-decoration: none; background: #fafafa; }
.chip-avatar { width: 22px; height: 22px; margin: 0; font-size: 11px; }
.chip-fallback { line-height: 22px; text-align: center; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain li.unread-item { background: #fbfcfe; }
.list-plain .snippet { margin-top: 6px; color: #444; font-size: 14px; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 16px; }
.member-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; gap: 12px; align-items: center; background: #fff;
}
.member-card img, .member-card .avatar {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); object-fit: cover;
  display: flex; align-items: center; justify-content: center; background: #efefef; font-weight: 700;
}
code { font-family: Consolas, "Courier New", monospace; font-size: 12px; background: #f5f5f5; padding: 2px 6px; border: 1px solid var(--line); border-radius: 8px; }

@media (max-width: 760px) {
  .post { grid-template-columns: 1fr; }
  .post-side {
    border-right: 0; border-bottom: 1px solid var(--line);
    display: grid; grid-template-columns: 52px 1fr; gap: 12px; text-align: left; align-items: center;
  }
  .post-side .avatar, img.avatar-img { width: 52px; height: 52px; margin: 0; font-size: 20px; }
  .post-side .name { margin: 0 0 4px; }
  .forum-table .col-author, .forum-table .col-stats:nth-child(4), .forum-table .col-time { display: none; }
  .container { padding: 0 12px; }
  .page-main { padding: 12px; }
}
