:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #eef2f6;
  --text: #111827;
  --muted: #64748b;
  --line: #d8dee8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #e11d48;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

.login-page {
  min-height: 100vh;
  background: #eef2f6;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand,
.nav,
.account-bar,
.tabs,
.composer-head,
.post-meta,
.engagement,
.category,
.form-actions,
.data-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

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

.nav {
  justify-content: center;
  gap: 6px;
}

.nav a {
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.nav a:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.account-bar {
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-weight: 750;
}

.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 750;
}

.shell {
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(0, 760px) minmax(190px, 260px);
  gap: 22px;
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card .brand {
  margin-bottom: 22px;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-card p {
  margin: 8px 0 18px;
  color: var(--muted);
}

.login-note {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 14px;
}

.login-note strong {
  color: var(--text);
}

.sidebar,
.rightbar {
  position: sticky;
  top: 92px;
  align-self: start;
}

.panel,
.composer,
.post,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel + .panel {
  margin-top: 16px;
}

.panel h2,
.composer h1,
.post h2 {
  margin: 0;
}

.panel h2 {
  margin-bottom: 14px;
  font-size: 16px;
}

.tabs {
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--surface-strong);
  border-radius: 8px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--surface-strong);
  border-radius: 8px;
}

.tab {
  flex: 1;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
}

.stack-form,
.post-form,
.feed,
.post-list,
.comments {
  display: grid;
  gap: 12px;
}

.stack-form label,
.post-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stack-form input,
.post-form input,
.post-form textarea,
.post-form select,
.admin-post-form input,
.admin-post-form textarea,
.admin-post-form select,
.comment-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.stack-form input,
.post-form input,
.post-form select,
.admin-post-form input,
.admin-post-form select,
.comment-form input {
  height: 44px;
  padding: 0 12px;
}

.admin-post-form textarea,
.post-form textarea {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.stack-form button,
.form-actions button,
.admin-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.danger-button {
  background: var(--danger) !important;
}

.stack-form button {
  background: var(--text);
}

.status-text {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.category {
  width: 100%;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.category:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.category strong,
.data-row strong {
  margin-left: auto;
  color: var(--text);
}

.compact p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.feed {
  gap: 18px;
}

.composer,
.post {
  overflow: hidden;
  padding: 20px;
}

.composer-head,
.post-meta {
  gap: 14px;
}

.composer-head {
  margin-bottom: 18px;
}

.composer-head img,
.post-meta img {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
}

.composer h1 {
  font-size: 22px;
}

.composer p,
.post-meta p {
  margin: 2px 0 0;
  color: var(--muted);
}

.form-actions {
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions select {
  width: 150px;
}

.post h2 {
  font-size: 18px;
}

.post-text {
  margin: 16px 0;
  color: #334155;
}

.media {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.image-media {
  aspect-ratio: 16 / 9;
}

.media-slot:empty {
  display: none;
}

.engagement {
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.engagement button,
.comment-form button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.comment-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.comments {
  margin-top: 12px;
}

.comments p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: #334155;
  font-size: 14px;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

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

.admin-row strong {
  display: block;
}

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

.admin-row select,
.admin-row input {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.admin-row-actions,
.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-row-actions button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-strong);
  cursor: pointer;
  font-weight: 800;
}

.admin-post-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.data-row {
  justify-content: space-between;
  min-height: 34px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 1060px) {
  .shell {
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  }

  .rightbar {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

  .shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .sidebar {
    position: static;
  }

  .form-actions,
  .engagement {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions select,
  .form-actions button {
    width: 100%;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }
}
