:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dfe7f4;
  --text: #202b3a;
  --muted: #5d6b7d;
  --primary: #1f6feb;
  --primary-dark: #184fa7;
  --success: #177f5d;
  --warning: #c38b09;
  --danger: #b64646;
  --shadow: rgba(15, 27, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.board-view {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

body.login-view {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

body.login-view .auth-shell {
  flex: 1;
  min-height: 0;
}

header.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem 2rem;
  box-shadow: 0 1px 0 var(--shadow);
}

header.topbar.narrow {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

body.admin-view header.topbar {
  padding-top: 0.49rem;
  padding-bottom: 0.49rem;
}

header.topbar h1 {
  font-size: 1.4rem;
}

.board-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.board-logo {
  display: block;
  width: 100px;
  height: 100px;
  margin: -16.5px 0;
  object-fit: contain;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.site-nav a,
button,
input,
select,
textarea {
  font: inherit;
}

.site-nav .nav-link {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.56rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.site-nav .nav-link:hover {
  border-color: var(--line);
  background: #f5f8fd;
  color: var(--primary-dark);
}

.site-nav .nav-link[aria-current="page"] {
  border-color: #d7e7ff;
  background: #edf4ff;
  color: var(--primary-dark);
}

.site-nav .nav-link:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.35);
  outline-offset: 2px;
}

.new-post-fab {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb35c, #f57c00 70%, #d96a00);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(217, 106, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.new-post-fab::before,
.new-post-fab::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 2px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.new-post-fab::before {
  width: 28px;
  height: 6px;
}

.new-post-fab::after {
  width: 6px;
  height: 28px;
}

.new-post-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(217, 106, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.new-post-fab:focus-visible {
  outline: 3px solid rgba(245, 124, 0, 0.45);
  outline-offset: 2px;
}

.site-nav .nav-logout {
  cursor: pointer;
}

.user-menu {
  position: relative;
}

.user-menu > summary {
  cursor: pointer;
  list-style: none;
}

.user-menu > summary::-webkit-details-marker {
  display: none;
}

.user-menu-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  right: 0;
  display: flex;
  min-width: 160px;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(15, 27, 42, 0.18);
}

.user-menu-list .nav-link {
  width: 100%;
  justify-content: flex-start;
}

.user-menu-list form {
  margin: 0;
}

.user-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  background: #edf4ff;
  border: 1px solid #d7e7ff;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 0.28rem 0.49rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.inline-form {
  display: inline;
}

button {
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-weight: 600;
}

button:hover {
  background: var(--primary-dark);
}

.confirm-dialog {
  width: min(420px, calc(100% - 2rem));
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 27, 42, 0.28);
}

.confirm-dialog::backdrop {
  background: rgba(16, 27, 42, 0.48);
  backdrop-filter: blur(3px);
}

.confirm-dialog-content {
  padding: 1.75rem;
}

.confirm-dialog-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #edf4ff;
  color: var(--primary);
  font-size: 1.4rem;
  font-weight: 700;
}

.confirm-dialog h2 {
  margin: 1rem 0 0.5rem;
  font-size: 1.3rem;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.confirm-cancel-button {
  background: #eef1f5;
  color: var(--text);
}

.confirm-cancel-button:hover {
  background: #dfe5ed;
}

.confirm-danger-button,
.confirm-danger-button:hover {
  background: var(--danger);
}

.confirm-danger-button:hover {
  background: #913737;
}

.delete-form {
  margin-top: 1rem;
}

.admin-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.archive-button {
  background: #5d6b7d;
}

.archive-button:hover {
  background: #465365;
}

.delete-button {
  background: var(--danger);
}

.delete-button:hover {
  background: #913737;
}

.post-card {
  position: relative;
  cursor: pointer;
}

.post-card.post-card-has-top-action {
  padding-top: 2.8rem;
}

.post-archive-form {
  position: absolute;
  z-index: 1;
  top: 0.4rem;
  left: 0.4rem;
  margin: 0;
}

.post-archive-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}

.post-archive-button:hover,
.post-archive-button:focus-visible {
  border-color: #d7e7ff;
  background: #edf4ff;
  color: var(--primary-dark);
}

.post-archive-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.post-delete-form {
  position: absolute;
  z-index: 1;
  top: 0.4rem;
  right: 0.4rem;
  margin: 0;
}

.post-delete-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
}

.post-delete-button:hover,
.post-delete-button:focus-visible {
  border-color: #f0caca;
  background: #fff0f0;
  color: var(--danger);
}

.post-delete-button:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.board-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  max-width: none;
  margin: 0;
}

.board-page > .bulletin-board {
  flex: 1;
}

.post-filter {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem 0.8rem;
  margin: 0 0 1rem;
  padding: 0.4rem 0.8rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(32, 43, 58, 0.18);
}

.post-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 160px;
}

.post-filter-search {
  flex: 1 1 280px;
}

.post-filter-label {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-filter input,
.post-filter select {
  width: 100%;
  margin: 0;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fd;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.post-filter input:focus,
.post-filter select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.2);
}

.post-filter-count {
  margin-left: auto;
  padding-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.post-filter-clear {
  padding: 0.25rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.post-filter-clear:hover {
  background: var(--primary-dark);
}

[hidden] {
  display: none !important;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 2rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
}

.terms-dialog {
  width: min(640px, calc(100% - 2rem));
  max-height: min(80vh, 720px);
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 27, 42, 0.28);
}

.terms-dialog::backdrop {
  background: rgba(16, 27, 42, 0.48);
  backdrop-filter: blur(3px);
}

.terms-dialog-content {
  overflow-y: auto;
  max-height: min(80vh, 720px);
  padding: 1.75rem;
}

.terms-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
}

.terms-dialog h3 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1rem;
}

.terms-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.terms-dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.post-modal {
  flex-direction: column;
  width: min(900px, calc(100% - 2rem));
  height: min(90vh, 900px);
  max-height: 90vh;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  color: var(--text);
  background: var(--bg);
  box-shadow: 0 24px 70px rgba(15, 27, 42, 0.28);
}

.post-modal[open] {
  display: flex;
}

.post-modal::backdrop {
  background: rgba(16, 27, 42, 0.58);
  backdrop-filter: blur(3px);
}

.post-modal-header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.post-modal-header h2 {
  overflow: hidden;
  margin: 0;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-modal-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}

.post-modal-full-link {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
}

.post-modal-full-link img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.post-modal-content {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 1rem;
}

.post-modal-content > .post-layout {
  max-width: none;
  margin: 0;
}

.post-modal-content > .post-layout > .panel {
  min-width: 0;
}

.bulletin-board > .hero {
  max-width: 1100px;
  margin: 0 auto 1.25rem;
  padding-top: 1rem;
}

.container.small {
  max-width: 700px;
}

.profile-page {
  width: min(820px, 100%);
  margin: 3rem auto;
}

.profile-panel {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 27, 42, 0.1);
}

.profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #f4f8ff 100%);
}

.profile-eyebrow {
  margin: 0 0 0.4rem;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-heading h2 {
  margin: 0;
  font-size: 1.5rem;
}

.profile-description {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.profile-role {
  flex: 0 0 auto;
  padding: 0.45rem 0.8rem;
  border: 1px solid #d7e7ff;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--primary-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.profile-details {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0.5rem 2rem 1rem;
}

.profile-detail {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.profile-detail dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.profile-detail dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.profile-detail:last-child {
  border-bottom: 0;
}

.hero {
  margin-bottom: 1.25rem;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(140px, calc((100% - 5rem) / 6)), 1fr));
  gap: 1rem;
  width: 100%;
  margin: 0 auto;
}

.bulletin-board {
  margin-right: -1rem;
  margin-left: -1rem;
  padding: 1rem;
  border: 8px solid #9b6538;
  background: #bd8550 url('/images/cork.jpg') center / cover;
  box-shadow:
    inset 0 0 0 2px rgba(255, 218, 164, 0.34),
    inset 0 0 18px rgba(72, 39, 20, 0.28),
    0 3px 8px rgba(54, 34, 19, 0.22);
}

.board-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0.75rem 0 0 1.5rem;
  position: relative;
  z-index: 1;
}

.board-tab {
  position: relative;
  padding: 0.45rem 1.5rem 0.4rem;
  border: 2px solid #9b6538;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(#e9cf9c, #d4ae72);
  color: #5a3a1c;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 240, 210, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 248, 225, 0.7), 0 -1px 4px rgba(54, 34, 19, 0.15);
  margin-bottom: 0;
  transition: padding 120ms ease, filter 150ms ease;
}

.board-tab:hover {
  filter: brightness(1.06);
  padding-top: 0.6rem;
}

.board-tab[aria-current="page"] {
  z-index: 2;
  margin-bottom: -8px;
  padding-top: 0.65rem;
  padding-bottom: calc(0.4rem + 8px);
  background: #bd8550 url('/images/cork.jpg') center / cover;
  color: #fff7e6;
  text-shadow: 0 1px 2px rgba(54, 34, 19, 0.7);
  box-shadow: inset 0 2px 0 rgba(255, 218, 164, 0.4), 0 -2px 5px rgba(54, 34, 19, 0.2);
}

.board-tab-search {
  margin-left: auto;
  margin-right: 1.5rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.board-tab-search:hover {
  filter: none;
  background: linear-gradient(#ecd5a8, #d9b57d);
}

.board-tab-search[aria-expanded="true"]:hover {
  background: #bd8550 url('/images/cork.jpg') center / cover;
}

.board-tab-search[aria-expanded="true"] {
  z-index: 2;
  margin-bottom: -8px;
  padding-top: 0.65rem;
  padding-bottom: calc(0.4rem + 8px);
  background: #bd8550 url('/images/cork.jpg') center / cover;
  color: #fff7e6;
  text-shadow: 0 1px 2px rgba(54, 34, 19, 0.7);
}

.board-tab:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.45);
  outline-offset: 2px;
}

.board-toast {
  animation: board-toast-fade 700ms ease 5s forwards;
}

@keyframes board-toast-fade {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.post-card,
.panel,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 25px var(--shadow);
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 3px 6px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.5),
    0 6px 10px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.12);
}

.voteable-post {
  background: #dcecff;
  border-color: #b9d3f0;
}

.post-card .admin-post-actions {
  justify-content: flex-end;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
}

.post-card .admin-post-actions button {
  padding: 0.35rem 0.5rem;
  font-size: 0.7rem;
}

.post-card .image-thumbnail {
  height: 126px;
}

.post-card .document-thumbnail {
  min-height: 70px;
  gap: 0.7rem;
  padding: 0.525rem;
}

.post-card .document-icon {
  flex-basis: 41px;
  height: 49px;
}

.post-card h3 {
  margin: 0.5rem 0;
}

.post-card h3 a {
  display: block;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  transition: color 150ms ease;
}

.post-card h3 a:hover,
.post-card h3 a:focus-visible {
  color: var(--primary);
}

.post-header,
.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.post-header {
  margin-bottom: 0.5rem;
}

.post-author-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 0.16rem 0.36rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.post-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.tag,
.category-tag,
.vote-tag {
  display: inline-block;
  padding: 0.16rem 0.36rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-right: 0.35rem;
}

.tag {
  background: #eef7ff;
  color: var(--primary-dark);
}

.category-tag {
  background: #f4eddf;
  color: #76522e;
}

.vote-tag {
  background: #eafaf2;
  color: var(--success);
}

.archive-tag {
  display: inline-block;
  padding: 0.16rem 0.36rem;
  border-radius: 999px;
  background: #f1f2f4;
  color: #4d5968;
  font-size: 0.65rem;
  font-weight: 700;
  margin: 0.2rem 0.35rem 0.2rem 0;
}

.archive-notice,
.empty-state {
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.meta,
.small-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  font-size: 0.8rem;
  line-height: 1.6;
  margin: 0.8rem 0 0;
  white-space: pre-wrap;
}

.image-preview-link,
.document-thumbnail {
  display: flex;
  overflow: hidden;
  margin-top: 0.9rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--line);
  text-decoration: none;
}

.image-preview-link {
  flex-direction: column;
  color: var(--primary);
  font-weight: 600;
}

.image-preview-link span {
  padding: 0.65rem 0.75rem;
}

.image-thumbnail {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #eef2f7;
}

.detail-image-preview .image-thumbnail {
  height: auto;
  max-height: 600px;
  object-fit: contain;
}

.document-thumbnail {
  min-height: 100px;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  color: var(--text);
}

.document-thumbnail:hover {
  border-color: var(--primary);
  background: #f1f6ff;
}

.document-icon {
  display: grid;
  flex: 0 0 58px;
  height: 70px;
  place-items: center;
  border-radius: 6px;
  background: #e8effa;
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
}

.document-label {
  display: grid;
  gap: 0.35rem;
}

.document-label span {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.asset-box a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card,
.panel {
  padding: 1.5rem;
}

.auth-card {
  width: min(420px, 100%);
}

label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.checkbox-line input {
  width: auto;
  margin-top: 0;
}

.alert {
  margin: 1rem auto 0;
  max-width: 1100px;
  background: #edf7ff;
  border: 1px solid #cfe4ff;
  color: var(--primary-dark);
  padding: 0.9rem 1rem;
  border-radius: 8px;
}

.category-edit-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-edit-form input {
  max-width: 24rem;
  margin-top: 0;
}

.category-create-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.category-create-form label {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.category-create-form button {
  flex-shrink: 0;
}

.admin-layout,
.post-layout {
  display: grid;
  gap: 1rem;
}

.admin-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 1600px;
  margin: 1rem auto;
}

.admin-layout > .alert {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  margin: 0;
}

.admin-section {
  min-width: 0;
  padding: 0.75rem;
}

.admin-section h2 {
  margin-top: 0;
}

.admin-section .small-text {
  margin-top: 0;
}

.admin-user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
}

.admin-user-form label {
  min-width: 0;
  margin: 0;
}

.admin-user-form button {
  justify-self: start;
}

.admin-section table {
  margin-top: 0.5rem;
}

.admin-section th,
.admin-section td {
  padding: 0.4rem 0.5rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-users table {
  min-width: 960px;
}

.admin-weight-form,
.admin-user-edit-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.admin-weight-form label {
  margin: 0;
}

.admin-weight-form select {
  width: 50%;
}

.admin-user-edit-form input,
.admin-user-edit-form select {
  width: auto;
  min-width: 90px;
}

.admin-user-edit-form input {
  width: 120px;
}

.admin-update-button {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 1rem;
  line-height: 1;
}

.admin-update-button:hover,
.admin-update-button:focus-visible {
  background: #11664b;
}

.admin-update-button:focus-visible {
  outline: 2px solid var(--success);
  outline-offset: 2px;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
}

.admin-user-actions form {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.vote-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.comments-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
  padding: 0.9rem;
}

.comment-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.comment-edit {
  margin-top: 0.75rem;
}

.comment-edit summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.comment-edit form {
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .tag,
  .category-tag,
  .vote-tag {
    margin-right: 0.2rem;
  }

  .archive-tag {
    margin-right: 0.2rem;
  }

  header.topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  header.topbar .site-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 0.25rem;
  }

  .site-nav .nav-link {
    min-height: 27px;
    padding: 0.3rem 0.45rem;
    font-size: 0.9rem;
  }

  .profile-page {
    margin: 1.5rem auto;
  }

  .profile-heading {
    align-items: flex-start;
    padding: 1.35rem;
  }

  .profile-details {
    padding: 0.35rem 1.35rem 0.75rem;
  }

  .profile-detail {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.9rem 0;
  }

  .bulletin-board {
    padding: 0.7rem;
    border-width: 6px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.65rem 1rem;
  }

  .terms-dialog-content {
    padding: 1.25rem;
  }

  .post-modal-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .post-modal-actions {
    width: 100%;
    justify-content: space-between;
  }

  .post-modal-content {
    padding: 0.75rem;
  }

  .admin-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .admin-users {
    grid-column: auto;
  }

  .admin-user-form {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) {
  .admin-users {
    grid-column: 1 / -1;
  }
}
