:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f6f4;
  --ink: #202326;
  --muted: #687279;
  --line: #dde3df;
  --brand: #146c5c;
  --brand-2: #b83b5e;
  --accent: #e3a72f;
  --danger: #b91c1c;
  --ok: #167245;
  --shadow: 0 18px 45px rgba(32, 35, 38, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

.boot-screen {
  display: none;
  width: min(720px, calc(100% - 32px));
  margin: 80px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

body.app-loading .boot-screen {
  display: block;
}

body.app-loading .layout,
body.app-loading .site-footer {
  display: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(246, 245, 242, 0.86);
  border-bottom: 1px solid rgba(221, 227, 223, 0.8);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand.compact {
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 17px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

a.category-button,
a.tab,
a.top-nav-link,
a.board-card,
a.latest-item,
a.digest-item {
  text-decoration: none;
}

.top-nav-link:hover,
.top-nav-link.active {
  background: var(--surface-2);
  color: var(--brand);
}

.nav-safe {
  border-color: rgba(184, 59, 94, 0.24);
  color: var(--brand-2);
}

.top-actions b {
  margin-left: 3px;
}

.primary,
.ghost,
.danger,
.small-action {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.danger {
  background: #fff1f1;
  color: var(--danger);
  border-color: #f2c5c5;
}

.small-action {
  min-height: 30px;
  padding: 5px 9px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.wide {
  width: 100%;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 24px;
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto 60px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel,
.post-card,
.hero,
.admin-card,
.table-card,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel-title {
  margin-bottom: 12px;
  font-weight: 800;
}

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

.category-list,
.link-list {
  display: grid;
  gap: 8px;
}

.category-button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

.category-button.active {
  border-color: var(--brand);
  background: var(--surface-2);
  color: var(--brand);
}

.feed-shell {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 22px 28px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(20, 108, 92, 0.12), rgba(227, 167, 47, 0.12)),
    #fff;
}

.hero h1 {
  max-width: 760px;
  margin: 0 0 10px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.12;
}

.hero p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
}

.home-search {
  display: grid;
  max-width: 560px;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.home-search input {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 9px 12px;
  font-size: 15px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-stats {
  display: flex;
  gap: 12px;
}

.hero-stats span {
  display: grid;
  min-width: 64px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.hero-stats b {
  color: var(--ink);
  font-size: 20px;
}

.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 12px;
}

.section-title-row.compact {
  margin-top: 0;
}

.section-title-row h2,
.board-header h2 {
  margin: 0;
  font-size: 24px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.board-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow);
}

.board-card:hover {
  border-color: var(--brand);
}

.board-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 20px;
  font-weight: 900;
}

.board-main {
  display: grid;
  align-content: start;
  gap: 4px;
}

.board-main b {
  font-size: 18px;
}

.board-main small {
  color: var(--muted);
  font-size: 13px;
}

.board-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.board-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
}

.board-stats b {
  display: block;
  color: var(--ink);
  font-size: 16px;
}

.latest-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.home-portal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.portal-main {
  display: grid;
  gap: 16px;
}

.home-portal .board-grid {
  align-items: stretch;
}

.home-portal .latest-panel {
  margin-top: 0;
}

.portal-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.portal-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 18px 48px rgba(18, 31, 29, 0.07);
}

.portal-image-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.portal-image-strip button,
.portal-image-strip a {
  display: grid;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}

.portal-image-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.portal-image-strip span,
.portal-resource-list span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-resource-list {
  display: grid;
}

.portal-resource-list button,
.portal-resource-list a {
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 9px 0;
  text-align: left;
  color: inherit;
}

.portal-resource-list button:last-child,
.portal-resource-list a:last-child {
  border-bottom: 0;
}

.portal-resource-list b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-side {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 48px rgba(18, 31, 29, 0.07);
  overflow: hidden;
}

.portal-card {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 14px 16px;
  box-shadow: none;
}

.portal-card:last-child {
  border-bottom: 0;
}

.portal-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.runtime-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.runtime-grid span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.runtime-grid b {
  display: block;
  color: var(--ink);
  font-size: 17px;
}

.digest-item {
  display: grid;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 0;
  text-align: left;
}

.digest-item:last-child {
  border-bottom: 0;
}

.digest-item b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digest-item span {
  color: var(--muted);
  font-size: 12px;
}

.safe-page {
  padding: 24px;
}

.safe-lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
}

.safe-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.safe-links a {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.safe-links a:hover {
  border-color: var(--brand);
}

.safe-links span {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.safe-note {
  border-left: 3px solid var(--brand);
  background: var(--surface-2);
  padding: 12px 14px;
  color: var(--muted);
}

.latest-list {
  display: grid;
  gap: 8px;
}

.latest-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

.latest-item > span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.board-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.board-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.board-kpis span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 13px;
}

.board-kpis b {
  color: var(--ink);
}

.board-kpis .board-latest {
  max-width: min(460px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 6px 12px;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 14px;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
}

.feed {
  display: grid;
  gap: 12px;
}

.forum-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.forum-row + .forum-row {
  margin-top: -6px;
}

.forum-row.is-global-pinned {
  border-left-color: #d83a3a;
  background: #fff8f6;
}

.forum-row.is-board-pinned {
  border-left-color: var(--brand);
  background: #f5fbf8;
}

.forum-row.is-featured:not(.is-global-pinned):not(.is-board-pinned) {
  border-left-color: #d79a00;
}

.forum-avatar {
  border: 0;
  background: transparent;
  padding: 0;
}

.forum-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.forum-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.forum-title {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
  text-align: left;
}

.forum-title:hover {
  color: var(--brand);
}

.is-global-pinned .forum-title {
  color: #b3261e;
  font-weight: 950;
}

.is-board-pinned .forum-title {
  color: var(--brand);
  font-weight: 920;
}

.forum-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-meta,
.forum-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.forum-tags span {
  border-radius: 999px;
  background: var(--surface-2);
  padding: 2px 7px;
  color: var(--brand);
  font-weight: 700;
}

.row-delete {
  align-self: center;
}

.resource-row {
  grid-template-columns: 92px minmax(0, 1fr) auto;
  min-height: 92px;
}

.resource-cover {
  width: 86px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 0;
  color: var(--brand);
  font-weight: 950;
}

.resource-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.resource-cover span {
  display: grid;
  height: 100%;
  place-items: center;
}

.post-card {
  padding: 18px;
}

.feed-post {
  position: relative;
  display: grid;
  gap: 8px;
  border-left: 4px solid transparent;
}

.feed-post.is-global-pinned {
  border-left-color: #d83a3a;
  background: linear-gradient(90deg, #fff6f3, #fff 38%);
}

.feed-post.is-board-pinned {
  border-left-color: var(--brand);
  background: linear-gradient(90deg, #f2fbf7, #fff 38%);
}

.feed-post.is-featured:not(.is-global-pinned):not(.is-board-pinned) {
  border-left-color: #d79a00;
}

.feed-post.is-global-pinned .post-title-button {
  color: #b3261e;
  font-weight: 950;
}

.feed-post.is-board-pinned .post-title-button {
  color: var(--brand);
  font-weight: 920;
}

.feed-post.is-featured .post-title-button {
  font-weight: 920;
}

.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--brand);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: #fff5d7;
  color: #8a5b00;
}

.badge.danger {
  background: #fff1f1;
  color: var(--danger);
}

.badge.ok {
  background: #e8f7ef;
  color: var(--ok);
}

.post-marker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.post-marker.global {
  background: #fff0ed;
  color: #b3261e;
}

.post-marker.board {
  background: #e8f7ef;
  color: var(--brand);
}

.post-marker.featured {
  background: #fff5d7;
  color: #8a5b00;
}

.post-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.post-title-button {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-size: 20px;
  font-weight: 850;
}

.post-title-button:hover {
  color: var(--brand);
}

.post-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 9px;
  color: var(--muted);
  font-size: 13px;
}

.meta-item b {
  display: block;
  color: var(--ink);
}

.detail-card {
  display: grid;
  gap: 14px;
}

.detail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-card h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.18;
}

.detail-summary {
  font-size: 16px;
}

.post-edit-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.post-edit-form textarea {
  min-height: 190px;
}

.detail-body {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--ink);
  white-space: normal;
}

.resource-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.resource-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  min-width: 0;
}

.resource-grid b {
  display: block;
  margin-bottom: 4px;
}

.magnet-box {
  min-height: 74px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.feedback-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-cover {
  width: min(320px, 100%);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.image-tile {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.feed-image-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 96px)) auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.feed-image-strip img {
  width: 96px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.feed-image-strip span {
  font-weight: 800;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.86);
}

.lightbox figure {
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
  min-width: 0;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}

.lightbox figcaption {
  color: #fff;
  font-size: 13px;
  text-align: center;
  word-break: break-all;
}

.lightbox-close,
.lightbox-nav {
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  font-size: 24px;
}

.lightbox-nav {
  width: 52px;
  height: 72px;
  font-size: 42px;
}

.comments-card {
  margin-top: 12px;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.comment-item p {
  margin: 4px 0;
}

.comment-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.post-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.link-action {
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
  font-size: 13px;
  font-weight: 800;
}

.danger-link {
  color: var(--danger);
}

.profile-editor {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
}

#profileAvatarPreview {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  object-fit: cover;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.profile-stats b {
  display: block;
  color: var(--ink);
}

.public-profile-head {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
}

.public-profile-head h2 {
  margin: 0 0 8px;
}

.profile-large-avatar {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.mini-list > div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.mini-list span {
  color: var(--muted);
  font-size: 13px;
}

.author-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.author-strip.as-button {
  width: 100%;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  text-align: left;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  object-fit: cover;
}

.author-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.author-main > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  padding: 0;
  background: transparent;
  overflow: auto;
}

.modal.large {
  width: min(820px, calc(100vw - 28px));
}

.modal.compose-modal {
  width: min(1120px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(32, 35, 38, 0.38);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 22px;
  width: 100%;
}

.modal-card.large {
  width: 100%;
}

.compose-card {
  gap: 16px;
  padding: clamp(22px, 3vw, 34px);
}

.modal-card h2 {
  margin: 0;
}

.modal-card label,
.setting-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  outline: 0;
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.attachment-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.attachment-list {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.attachment-chip b {
  color: var(--ink);
  font-size: 12px;
}

.icon-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.admin-body {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.admin-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: #202326;
  color: #fff;
}

.admin-nav .brand small {
  color: rgba(255, 255, 255, 0.65);
}

.nav-item {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  padding: 10px 12px;
  text-align: left;
}

.nav-item.active {
  background: #fff;
  color: var(--ink);
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header h1 {
  margin: 0;
}

.user-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 12px;
  color: var(--muted);
}

.admin-view {
  display: grid;
  gap: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-card {
  padding: 16px;
}

.admin-card b {
  display: block;
  font-size: 28px;
}

.table-card {
  overflow: auto;
}

.crawler-center {
  gap: 10px;
}

.crawler-center .admin-grid.compact-stats {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.crawler-center .admin-grid.compact-stats .admin-card {
  padding: 11px 12px;
}

.crawler-center .admin-grid.compact-stats .admin-card b {
  font-size: 22px;
}

.crawler-create-panel[hidden] {
  display: none;
}

.crawler-source-table th,
.crawler-source-table td,
.crawler-log-table th,
.crawler-log-table td {
  padding: 8px 10px;
}

.crawler-log-table {
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-filterbar {
  display: grid;
  gap: 10px;
}

.collector-form {
  display: grid;
  gap: 8px;
}

.collector-form .section-title-row {
  margin-bottom: 0;
}

.collector-form .setting-row {
  gap: 8px;
}

.collector-form input,
.collector-form select,
.collector-form textarea {
  min-height: 36px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  word-break: break-all;
}

.compact-tabs .tab {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
}

.compact-content-filter {
  padding: 10px;
}

.content-batchbar {
  padding-top: 2px;
}

.post-admin-table th,
.post-admin-table td {
  padding: 7px 9px;
}

.post-title-cell {
  min-width: 320px;
  max-width: 520px;
}

.post-title-cell .muted {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.admin-post-title {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-weight: 850;
  cursor: pointer;
}

.admin-post-title:hover {
  color: var(--brand);
}

.admin-post-detail {
  display: grid;
  gap: 14px;
}

.admin-edit-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.admin-edit-form textarea {
  min-height: 180px;
}

.admin-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.admin-image-grid a {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.admin-image-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.post-row-actions {
  min-width: 104px;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

.compact-log-card {
  max-height: 520px;
}

.log-detail {
  display: block;
  max-width: 560px;
  max-height: 38px;
  overflow: hidden;
}

.slim-note {
  padding: 10px 12px;
  color: var(--muted);
}

.inline-edit,
.number-edit {
  min-height: 34px;
  padding: 7px 9px;
}

.number-edit {
  max-width: 96px;
}

.subcategory-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
}

.chip-button.active {
  border-color: var(--brand);
  color: var(--brand);
  background: #eef8f4;
}

.chip-button b {
  margin-left: 4px;
}

.danger-text {
  color: var(--danger);
  border-color: #f2c5c5;
  background: #fff7f7;
}

.setting-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.site-footer {
  display: grid;
  gap: 8px;
  width: min(1280px, calc(100% - 48px));
  margin: 18px auto 36px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.site-footer strong {
  color: var(--ink);
}

.site-footer p {
  max-width: 980px;
  margin: 0;
}

body.home-mode {
  background:
    radial-gradient(circle at 22% 0%, rgba(20, 108, 92, 0.08), transparent 34%),
    linear-gradient(180deg, #fbfcfb 0%, #f4f2ed 100%);
}

.home-mode .layout {
  grid-template-columns: minmax(0, 1180px);
  justify-content: center;
  width: min(1240px, calc(100% - 48px));
  margin-top: 22px;
}

.home-mode .sidebar {
  display: none;
}

.home-mode .hero {
  min-height: 230px;
  align-items: end;
  padding: 32px 40px;
  margin-bottom: 18px;
  border-radius: 12px;
  background:
    linear-gradient(120deg, rgba(20, 108, 92, 0.12) 0%, rgba(245, 250, 247, 0.96) 44%, rgba(238, 210, 132, 0.22) 100%),
    #fff;
  box-shadow: 0 28px 80px rgba(20, 30, 28, 0.1);
}

.home-mode .hero h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(38px, 4.6vw, 58px);
  line-height: 1.08;
}

.home-mode .hero p {
  max-width: 780px;
  font-size: 16px;
  line-height: 1.65;
}

.home-mode .home-search {
  max-width: 640px;
  margin-top: 16px;
}

.home-mode .home-search input {
  min-height: 42px;
  padding: 10px 14px;
  font-size: 15px;
}

.home-mode .hero-stats {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
}

.home-mode .hero-stats span {
  min-width: 96px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.86);
}

.home-mode .hero-stats b {
  font-size: 26px;
}

.home-mode .section-title-row {
  margin: 22px 0 14px;
}

.home-mode .board-grid {
  gap: 16px;
}

.home-mode .board-card {
  min-height: 138px;
  padding: 18px;
  border-color: rgba(20, 108, 92, 0.14);
  box-shadow: 0 18px 48px rgba(18, 31, 29, 0.07);
}

.home-mode .board-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(18, 31, 29, 0.1);
}

.home-mode .board-main b {
  font-size: 19px;
}

.home-mode .latest-panel {
  margin-top: 18px;
  padding: 20px;
  box-shadow: 0 18px 48px rgba(18, 31, 29, 0.07);
}

.home-mode .latest-list button,
.home-mode .latest-list a {
  min-height: 44px;
}

@media (max-width: 920px) {
  .layout,
  .admin-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .hero,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-nav,
  .top-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero {
    display: grid;
  }

  .hero-stats,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-nav {
    position: static;
    height: auto;
  }

  .admin-grid,
  .form-grid,
  .attachment-box,
  .setting-row,
  .resource-grid,
  .board-grid,
  .board-header,
  .profile-editor,
  .profile-stats,
  .public-profile-head {
    grid-template-columns: 1fr;
  }

  .detail-topline,
  .comment-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .home-mode .layout {
    width: min(100% - 24px, 1280px);
  }

  .home-mode .hero {
    min-height: auto;
    padding: 28px;
  }

  .home-mode .hero h1 {
    font-size: clamp(38px, 11vw, 56px);
  }

  .home-mode .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-portal {
    grid-template-columns: 1fr;
  }

  .portal-preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .admin-header,
  .post-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions > * {
    flex: 1;
    text-align: center;
  }
}
