:root {
  --bg: #0f172a;
  --card: #0b1224;
  --muted: #94a3b8;
  --text: #e2e8f0;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --page-bg: radial-gradient(circle at 10% 20%, #1e293b 0%, #0f172a 55%);
  --surface: rgba(15, 23, 42, 0.6);
  --surface-strong: rgba(30, 41, 59, 0.7);
  --border: rgba(148, 163, 184, 0.2);
  --badge-bg: rgba(56, 189, 248, 0.15);
  --active-bg: rgba(56, 189, 248, 0.2);
  --active-border: rgba(56, 189, 248, 0.35);
  --active-shadow: rgba(14, 165, 233, 0.18);
  --secondary-bg: rgba(148, 163, 184, 0.2);
  --secondary-shadow: rgba(148, 163, 184, 0.2);
  --overlay: rgba(2, 6, 23, 0.55);
}

:root[data-theme="mono"] {
  --bg: #f4f4f4;
  --card: #ffffff;
  --muted: #5f5f5f;
  --text: #111111;
  --accent: #111111;
  --accent-2: #444444;
  --danger: #111111;
  --page-bg: linear-gradient(180deg, #ffffff 0%, #ececec 100%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(240, 240, 240, 0.96);
  --border: rgba(17, 17, 17, 0.14);
  --badge-bg: rgba(17, 17, 17, 0.08);
  --active-bg: rgba(17, 17, 17, 0.1);
  --active-border: rgba(17, 17, 17, 0.2);
  --active-shadow: rgba(17, 17, 17, 0.1);
  --secondary-bg: rgba(17, 17, 17, 0.08);
  --secondary-shadow: rgba(17, 17, 17, 0.12);
  --overlay: rgba(17, 17, 17, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--page-bg);
  color: var(--text);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 12px;
}

body.site-shell {
  display: block;
  padding: 18px 12px 28px;
}

.page-shell-wide,
.page-shell-narrow {
  width: 100%;
  margin: 0 auto;
}

.page-shell-wide {
  max-width: 1480px;
}

.page-shell-narrow {
  max-width: 420px;
}

.site-brand-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  text-decoration: none;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.2);
}

.site-brand-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.14);
  flex-shrink: 0;
}

.site-brand-copy {
  min-width: 0;
}

.site-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.site-brand-description {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.card {
  width: 100%;
  max-width: 420px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.6);
}

:root[data-theme="mono"] .card,
:root[data-theme="mono"] .panel {
  box-shadow: 0 16px 36px rgba(17, 17, 17, 0.08);
}

:root[data-theme="mono"] input,
:root[data-theme="mono"] textarea {
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.02);
}

h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

p {
  margin: 0 0 20px;
  color: var(--muted);
}

label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  margin-bottom: 16px;
}

button {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(56, 189, 248, 0.3);
}

.btn-inline {
  width: auto;
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text);
  box-shadow: none;
}

.btn-secondary:hover {
  box-shadow: 0 10px 20px var(--secondary-shadow);
}

.link {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--accent);
  text-decoration: none;
}

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: none;
}

.alert.error {
  display: block;
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.alert.success {
  display: block;
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.dashboard {
  width: min(100%, 1480px);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.header-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--badge-bg);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid.editor-layout {
  grid-template-columns: 1fr;
}

.drawer-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.entry-drawer {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  width: 100%;
  max-height: calc(100vh - 32px);
}

.entry-drawer.open {
  transform: none;
}

.drawer-main {
  min-width: 0;
  min-height: 65vh;
}

.site-admin-panel {
  display: grid;
  gap: 18px;
}

.site-admin-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.site-identity-card,
.site-tags-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  padding: 16px;
}

.site-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.15);
}

.site-icon-tools {
  margin-top: 14px;
}

.site-settings-form {
  display: grid;
  gap: 10px;
}

.site-settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.site-tags-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.tag-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.tag-item-empty {
  color: var(--muted);
  justify-content: center;
}

.tag-item-main {
  min-width: 0;
}

.tag-item-header {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--badge-bg);
  font-size: 12px;
  color: var(--muted);
}

.tag-item-meta,
.tag-item-desc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.tag-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.group-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.group-name {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.group-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.group-action-btn {
  margin-top: 10px;
  width: 100%;
}

.group-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.drawer-history-section {
  margin-top: 16px;
}

.drawer-footer {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.drawer-section {
  margin-bottom: 12px;
}

.drawer-help {
  margin: 10px 0 12px;
  font-size: 13px;
}

.meta-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.meta-list li {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.meta-title {
  font-size: 13px;
  color: var(--text);
}

.meta-subtitle,
.meta-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

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

.sidebar-toggle {
  display: none;
}

.drawer-close {
  display: none;
}

.drawer-backdrop {
  display: none;
}

.drawer-backdrop.open {
  opacity: 1;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.profile-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid var(--border);
  object-fit: cover;
}

.profile-meta {
  flex: 1;
}

.icon-editor {
  margin-top: 12px;
  display: none;
}

.icon-editor.active {
  display: block;
}

.icon-canvas {
  width: 160px;
  height: 160px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  cursor: grab;
}

.icon-canvas:active {
  cursor: grabbing;
}

.range-input {
  width: 160px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 20, 0.6);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 460px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.modal-card-wide {
  width: min(92vw, 860px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.modal-title {
  margin: 10px 0 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-body {
  display: grid;
  gap: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.form-label {
  font-size: 12px;
  color: var(--muted);
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

.posts-page {
  width: min(100%, 1100px);
}

.posts-filter-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.post-filter-tabs,
.post-filter-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.post-filter-btn.active,
.post-tag-filter.active {
  background: var(--accent);
  color: var(--bg);
}

.post-tag-filter {
  width: auto;
  border: none;
  cursor: pointer;
}

.post-form-panel {
  margin-bottom: 18px;
}

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

.task-form-fields {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
}

.task-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.post-form-actions {
  display: flex;
  justify-content: flex-end;
}

.post-list {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.markdown-list {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.markdown-card {
  display: grid;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.markdown-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.markdown-card-meta {
  font-size: 13px;
  color: var(--muted);
}

.post-card {
  display: grid;
  gap: 12px;
}

.post-detail {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.post-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.post-content {
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
}

.post-images {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.post-images img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
}

.post-videos {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.post-videos video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
  max-height: 320px;
  cursor: zoom-in;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.video-modal.open {
  display: flex;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
}

.video-modal-content {
  position: relative;
  z-index: 1;
  width: min(96vw, 1100px);
  display: grid;
  gap: 10px;
  justify-items: end;
}

.video-modal-player {
  width: 100%;
  max-height: calc(100vh - 120px);
  background: #000;
  border-radius: 12px;
}

.video-modal-close {
  min-width: 88px;
}

.post-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.task-summary-strip,
.task-meta-grid {
  display: grid;
  gap: 8px;
}

.task-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(200px, max-content));
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.task-meta-card,
.task-applicants-panel,
.task-results-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.task-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.task-applicant-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.task-result-form,
.task-result-list {
  display: grid;
  gap: 10px;
}

.task-result-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.profile-page {
  display: grid;
  gap: 18px;
}

.profile-detail-card,
.profile-section {
  display: grid;
  gap: 12px;
}

.profile-hero {
  display: flex;
  gap: 18px;
  align-items: center;
}

.profile-hero-avatar {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.profile-hero-body {
  display: grid;
  gap: 8px;
}

.profile-hero-body h2 {
  margin: 0;
}

.profile-meta-line {
  font-size: 13px;
  color: var(--muted);
}

.profile-bio-copy {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text);
}

.profile-recommendation-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.task-applicant-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.task-applicant-id {
  font-size: 12px;
  color: var(--muted);
}

.reply-box {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  display: none;
  gap: 10px;
}

.reply-box.open {
  display: grid;
}

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

.reply-item {
  background: var(--surface-strong);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
}

.reply-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.reply-body {
  flex: 1;
}

.reply-content {
  font-size: 13px;
  color: var(--text);
}

.reply-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.reply-empty,
.post-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--surface-strong);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.list li:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.4);
}

.list li.active {
  background: var(--active-bg);
  border: 1px solid var(--active-border);
  box-shadow: 0 12px 24px var(--active-shadow);
}

.content-box {
  white-space: normal;
  line-height: 1.6;
  color: var(--text);
  font-size: 14px;
  min-height: 420px;
}

.content-box > :first-child {
  margin-top: 0;
}

.content-box > :last-child {
  margin-bottom: 0;
}

.content-box p,
.content-box ul,
.content-box ol,
.content-box blockquote,
.content-box pre {
  margin: 0 0 10px;
}

.content-box h1,
.content-box h2,
.content-box h3,
.content-box h4,
.content-box h5,
.content-box h6 {
  margin: 14px 0 8px;
  line-height: 1.35;
}

.content-box ul,
.content-box ol {
  padding-left: 20px;
}

.content-box li {
  margin-bottom: 4px;
}

.content-box pre,
.content-box code {
  white-space: pre-wrap;
  word-break: break-word;
}

.content-box img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border-radius: 12px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.status-text {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.toolbar input {
  flex: 1;
  margin-bottom: 0;
}

textarea {
  width: 100%;
  min-height: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-family: inherit;
  resize: vertical;
}

@media (max-width: 860px) {
  body {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
  }

  body.site-shell {
    padding: 14px;
  }

  .dashboard {
    width: 100%;
    max-width: none;
    padding: 16px;
  }

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

  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .drawer-layout {
    position: relative;
    display: block;
  }

  .entry-drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    width: min(86vw, 360px);
    height: 100vh;
    max-height: none;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  .entry-drawer.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .drawer-close {
    display: inline-flex;
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: block;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-main {
    min-height: auto;
  }

  .content-box {
    min-height: 280px;
  }

  .site-brand-banner {
    align-items: flex-start;
  }

  .site-admin-grid {
    grid-template-columns: 1fr;
  }

  .modal-card-wide {
    width: min(94vw, 860px);
    max-height: calc(100vh - 28px);
    padding: 16px;
  }

  .site-tags-header,
  .tag-item {
    flex-direction: column;
  }

  .tag-item-actions {
    width: 100%;
    justify-content: stretch;
  }
}

.post-author-name {
  color: var(--text);
  font-weight: 600;
}

.chat-link {
  color: var(--accent);
  text-decoration: none;
}

.chat-link:hover {
  text-decoration: underline;
}

.chat-page {
  width: min(100%, 1480px);
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 140px);
  overflow: hidden;
}

.chat-list-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.chat-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-item.active {
  border-color: var(--active-border);
  background: var(--active-bg);
  box-shadow: 0 12px 30px var(--active-shadow);
  transform: translateY(-1px);
}

.chat-item-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 60vh;
}

.chat-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chat-title {
  font-size: 18px;
  font-weight: 700;
}

.chat-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 6px;
}

.message-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-item.mine {
  align-items: flex-end;
}

.message-item.other {
  align-items: flex-start;
}

.message-meta {
  font-size: 12px;
  color: var(--muted);
}

.message-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-item.mine .message-head {
  flex-direction: row-reverse;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.2);
}

.avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.2);
}

.message-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  max-width: 70%;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.message-bubble.deleted {
  color: var(--muted);
  font-style: italic;
}

.message-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-item.mine .message-bubble {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.35);
}

.message-revoke {
  width: auto;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--secondary-bg);
  color: var(--text);
  box-shadow: none;
}

.message-revoke:hover {
  box-shadow: 0 8px 18px var(--secondary-shadow);
}

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

.message-input {
  flex: 1;
  margin-bottom: 0;
}

.chat-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  font-size: 12px;
  font-weight: 600;
}

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

  .chat-list {
    max-height: none;
  }

  .message-list {
    max-height: none;
  }
}
