* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Background effects */
.bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.bg-canvas + header {
  position: relative;
  z-index: 1;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

.bg-menu-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, background 0.2s;
}

.bg-menu-btn:hover {
  transform: scale(1.08);
}

.bg-menu-btn.active {
  background: var(--primary);
  color: #fff;
}

.bg-panel {
  position: fixed;
  right: 18px;
  bottom: 74px;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  z-index: 1001;
  padding: 10px;
  display: none;
}

.bg-panel.open {
  display: block;
}

.bg-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.bg-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.bg-panel-close:hover {
  color: var(--text);
}

.bg-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
}

.bg-option:hover {
  background: var(--input-bg);
}

.bg-option.active {
  background: var(--primary);
  color: #fff;
}

.bg-option i {
  width: 20px;
  text-align: center;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 0;
  flex-shrink: 0;
}

nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

nav a {
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav-logout {
  color: var(--text-muted) !important;
}

.nav-logout:hover {
  color: var(--accent) !important;
}

.nav-admin {
  color: var(--accent) !important;
  font-weight: 600;
}

.nav-discord {
  background: #5865F2;
  color: #fff !important;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-discord:hover {
  background: #4752c4;
  text-decoration: none;
}

/* Main content */
.container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 30px auto;
  padding: 0 20px;
}

.page-header {
  margin-bottom: 25px;
}

/* Home page recent posts section */
.home-section {
  margin-top: 30px;
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.home-section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-section-header h2 i {
  color: var(--primary);
}

/* Homepage two-column layout + pinned sidebar */
.home-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.home-main {
  flex: 1;
  min-width: 0;
}

.home-sidebar {
  width: 300px;
  flex-shrink: 0;
}

.pinned-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px;
  position: sticky;
  top: 15px;
}

.pinned-sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.pinned-sidebar-header i {
  color: var(--primary);
}

.no-pins {
  font-size: 0.9rem;
  margin: 0;
}

.pinned-item {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.pinned-item:last-child {
  border-bottom: none;
}

.pinned-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.pinned-title:hover {
  color: var(--link);
}

.pinned-icon {
  color: var(--primary);
  margin-top: 2px;
  flex-shrink: 0;
}

.pinned-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
  padding-left: 20px;
}

@media (max-width: 900px) {
  .home-layout {
    flex-direction: column;
  }
  .home-sidebar {
    width: 100%;
  }
  .pinned-sidebar {
    position: static;
  }
}

/* Pin/unpin button on topic/page headers */
.pin-form {
  margin-left: 2px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.subtitle {
  color: var(--text-muted);
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat i {
  color: var(--primary);
  font-size: 1.2rem;
}

.stat span {
  font-weight: 700;
  font-size: 1.2rem;
}

/* Categories */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color 0.2s;
}

.category-card:hover {
  border-color: var(--primary);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-info h3 a {
  color: var(--text);
}

.category-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 3px 0 8px;
}

.category-meta {
  display: flex;
  gap: 15px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.category-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.category-last-post {
  text-align: right;
  min-width: 200px;
  max-width: 250px;
  font-size: 0.9rem;
  color: var(--text);
}

.category-last-post > a {
  display: block;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: block;
}

/* Game servers */
.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, transform 0.2s;
}

.server-card:hover {
  transform: translateY(-2px);
}

.server-card.server-online {
  border-left: 4px solid #00b894;
}

.server-card.server-offline {
  border-left: 4px solid #e74c3c;
  opacity: 0.75;
}

.server-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.server-header h3 {
  margin: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.server-header h3 i {
  color: var(--accent);
}

.server-game {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.server-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.server-status i {
  font-size: 0.6rem;
}

.server-status.online {
  background: rgba(0, 184, 148, 0.15);
  color: #00b894;
}

.server-status.offline {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.server-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.server-addr,
.server-players {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-family: 'Consolas', 'Courier New', monospace;
}

.server-addr i,
.server-players i {
  color: var(--text-muted);
  width: 18px;
  text-align: center;
}

.player-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--input-bg);
  overflow: hidden;
  flex: 1;
}

.player-bar div {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.server-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.admin-form .form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.admin-form .form-row .input-sm,
.admin-form .form-row .input-tiny {
  max-width: 130px;
}

.admin-form .form-row input[name="name"] {
  max-width: 160px;
  font-weight: 600;
}

/* Topics list */
.topics-list {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.topic-row.pinned {
  border-left: 4px solid var(--accent);
}

.topic-status {
  width: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.topic-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.topic-info {
  flex: 1;
  min-width: 0;
}

.topic-info h4 {
  font-size: 1.05rem;
  margin-bottom: 3px;
}

.topic-info h4 a {
  color: var(--text);
}

.topic-info h4 a:hover {
  color: var(--primary);
}

.topic-stats {
  text-align: right;
  font-size: 0.85rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
}

.btn:hover {
  text-decoration: none;
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

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

.btn-primary:hover {
  background: var(--secondary);
  border-color: var(--secondary);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
  border-color: #c0392b;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input[type="color"] {
  width: 60px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  cursor: pointer;
  padding: 2px;
}

.input-sm {
  width: auto;
  padding: 5px 8px;
  font-size: 0.85rem;
  margin-right: 5px;
}

.input-tiny {
  width: 60px;
}

.input-wide {
  min-width: 150px;
}

.textarea-sm {
  width: 100%;
  height: auto;
  min-height: 60px;
  padding: 8px;
  font-size: 0.85rem;
  margin: 5px 0;
}

/* Quill editors inside the admin pages table */
.admin-table .ql-container {
  max-height: 160px;
  overflow-y: auto;
  margin: 5px 0;
}

/* Page editor card edit mode */
.page-create-card.editing {
  border-left: 4px solid var(--accent);
}

.page-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.page-content-preview {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 350px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: 0.85rem;
}

.checkbox-inline input {
  width: auto;
}

.form-checkbox {
  margin: 10px 0;
}

.form-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-checkbox input {
  width: auto;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.alert-error {
  background: color-mix(in srgb, #e74c3c 15%, transparent);
  border: 1px solid #e74c3c;
  color: #f8d7da;
}

.alert-warning {
  background: color-mix(in srgb, #f39c12 15%, transparent);
  border: 1px solid #f39c12;
  color: #fdebd0;
}

.alert-success {
  background: color-mix(in srgb, #00b894 15%, transparent);
  border: 1px solid #00b894;
  color: #d1f2eb;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Auth */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 35px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.auth-card h2 {
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-card h2 i {
  color: var(--primary);
}

.auth-card form {
  text-align: left;
}

.auth-link {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-sub {
  margin: -10px 0 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Posts */
.breadcrumb {
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-header {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.topic-header h1 {
  font-size: 1.6rem;
}

.badge {
  background: var(--primary);
  color: #fff;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  overflow: hidden;
}

.post-sidebar {
  width: 200px;
  padding: 20px;
  border-right: 1px solid var(--border);
  background: var(--input-bg);
  flex-shrink: 0;
  text-align: center;
}

.post-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 12px;
}

.post-author strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 5px;
}

.post-content {
  flex: 1;
  padding: 20px;
  line-height: 1.7;
  white-space: normal;
  overflow-wrap: break-word;
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}

.post-content iframe.ql-video,
.post-content iframe {
  display: block;
  max-width: 100%;
  width: 100%;
  min-height: 260px;
  aspect-ratio: 16/9;
  border-radius: 8px;
  margin: 10px 0;
  border: none;
}

.post-content pre,
.post-content blockquote {
  background: var(--input-bg);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0;
  overflow-x: auto;
}

.ql-editor {
  min-height: 180px;
}

.post-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.reply-submit-row {
  margin-top: 10px;
}

.post-snippet {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  max-height: 60px;
  overflow: hidden;
}

.post-snippet img {
  max-width: 120px;
  border-radius: 4px;
}

.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
}

.profile-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.profile-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.profile-tab:hover {
  color: var(--text);
  border-color: var(--primary);
}

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

.profile-tab-panel {
  display: none;
  margin-bottom: 25px;
}

.profile-tab-panel.active {
  display: block;
}

/* Reply form */
.reply-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
}

.reply-form h3 {
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.reply-form form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reply-form .btn {
  align-self: flex-start;
}

.locked-notice {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  text-align: center;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 15px;
  color: var(--border);
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 5px;
}

/* Profile */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 25px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 700;
}

.topic-avatar img,
.post-avatar img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

.profile-bio {
  color: var(--text);
  background: var(--input-bg);
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--input-bg);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.link-badge:hover {
  transform: translateY(-1px);
  color: #fff;
}

.link-badge.discord { background: #5865F2; border-color: #5865F2; }
.link-badge.twitch { background: #6441a5; border-color: #6441a5; }
.link-badge.website { background: var(--primary); border-color: var(--primary); }

.link-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-input .link-icon {
  width: 36px;
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.link-input .steam-ic { color: #66c0f4; }
.link-input .discord-ic { color: #5865F2; }
.link-input .twitch-ic { color: #9146FF; }
.link-input .website-ic { color: var(--accent); }

.link-input input {
  flex: 1;
}

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

.avatar-form .avatar-actions .btn {
  margin: 0;
}

.link-input input { padding: 8px 10px; }

a.post-author-link { color: inherit; text-decoration: none; }
a.post-author-link:hover { color: var(--primary); text-decoration: underline; }

.profile-info h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.profile-info p {
  margin-bottom: 3px;
  font-size: 0.95rem;
}

.profile-info .badge {
  margin-top: 8px;
  display: inline-block;
}

/* Static page */
.static-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 30px;
}

.static-page h1 {
  font-size: 1.6rem;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.static-content {
  line-height: 1.8;
}

/* Admin panel */
.admin-banner {
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.admin-banner a {
  color: #fff;
  font-weight: 600;
}

.admin-layout {
  display: flex;
  gap: 25px;
  align-items: flex-start;
}

.admin-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  min-width: 220px;
  position: sticky;
  top: 20px;
}

.admin-sidebar h3 {
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-sidebar nav a {
  color: var(--text);
  padding: 9px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.admin-sidebar nav a:hover {
  background: var(--input-bg);
  text-decoration: none;
  color: var(--primary);
}

.admin-sidebar nav a.active {
  background: var(--primary);
  color: #fff;
}

.back-to-forum {
  display: block;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.back-to-forum:hover {
  color: var(--primary);
}

.admin-content {
  flex: 1;
  min-width: 0;
}

.admin-content h1 {
  font-size: 1.7rem;
  margin-bottom: 20px;
}

.admin-content h2 {
  font-size: 1.2rem;
  margin: 25px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.admin-stat i {
  font-size: 1.6rem;
  color: var(--primary);
}

.admin-stat strong {
  font-size: 1.5rem;
  display: block;
}

.admin-stat span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.admin-card h3 {
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--input-bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: color-mix(in srgb, var(--input-bg) 50%, transparent);
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.inline-form.inline-form-stacked {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  background: var(--input-bg);
  border-radius: 8px;
  width: 100%;
}

/* Category editor rows */
.cat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cat-row .input-sm {
  margin-right: 0;
}

.cat-icon {
  font-size: 1.05rem;
  width: 28px;
  text-align: center;
}

.cat-name {
  flex: 1 1 160px;
  min-width: 140px;
}

.cat-icon-input {
  flex: 0 1 150px;
  min-width: 120px;
}

.cat-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cat-desc {
  width: 100%;
  flex: 1;
}

.cat-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

/* Theme editor */
.theme-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 25px;
}

.theme-editor h3 {
  margin: 25px 0 15px;
  font-size: 1.1rem;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

.color-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.color-input {
  width: 70px !important;
  height: 45px !important;
}

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

/* Themes grid */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.theme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.theme-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
}

.theme-preview {
  height: 120px;
  background: var(--preview-bg);
  position: relative;
}

.preview-header {
  height: 25px;
  background: var(--preview-primary);
}

.preview-body {
  display: flex;
  padding: 10px;
  gap: 8px;
}

.preview-sidebar {
  width: 50px;
  height: 70px;
  background: var(--preview-surface);
  border-radius: 4px;
}

.preview-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-line {
  height: 8px;
  background: var(--preview-surface);
  border-radius: 4px;
}

.theme-info {
  padding: 15px;
}

.theme-info h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.theme-colors {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

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

.new-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  border-style: dashed;
  border-width: 2px;
}

.new-theme .theme-info {
  text-align: center;
}

.admin-settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Footer */
footer {
  background: var(--header-bg);
  border-top: 1px solid var(--border);
  padding: 20px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    position: static;
    width: 100%;
  }

  .admin-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .post-card {
    flex-direction: column;
  }

  .post-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .category-card {
    flex-direction: column;
    text-align: center;
  }

  .category-last-post {
    text-align: center;
    max-width: 100%;
  }

  .category-meta {
    justify-content: center;
  }

  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 10px 0;
    gap: 10px;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
  }
}
