.messages-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(190px, auto);
  align-items: stretch;
  width: 100%;
  height: auto;
  min-height: 1px;
  gap: 18px;
  overflow: visible;
}

.message-card {
  position: relative;
  inset: auto;
  width: auto;
  height: auto;
  min-height: 190px;
  visibility: visible;
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.message-card.trigger {
  border: 2px solid var(--red);
}

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

.message-meta b {
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.message-card p {
  flex: 1;
  white-space: pre-wrap;
}

.message-media {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 14px -8px 0;
}

.message-media-album {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.message-media a {
  display: block;
  min-width: 0;
}

.message-media img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--line);
}

.message-media-album img {
  height: 150px;
}

.message-card a {
  color: var(--green);
  font-weight: 700;
}

.warning-target {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--amber);
  font-weight: 750;
  cursor: pointer;
}

.warning-target input {
  accent-color: var(--amber);
}

.case-timing {
  display: flex;
  flex-direction: column;
}

.warned-mark,
.warned-note {
  color: var(--amber);
  font-weight: 750;
}

.warned-note {
  margin: 8px 0 0;
}

.similar-head,
.similar-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) .55fr .55fr 1fr 40px;
  gap: 18px;
  align-items: center;
  padding: 15px 20px;
}

.similar-head {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.similar-row {
  color: inherit;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.similar-row:last-child {
  border-bottom: 0;
}

.similar-row:hover {
  background: #f7f6ef;
}

.similar-row > span:first-child {
  display: flex;
  flex-direction: column;
}

.similar-row small {
  color: var(--muted);
}

.similar-author {
  flex: none !important;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.similar-author a,
.case-header .muted a {
  color: var(--green);
  font-weight: 700;
}

header nav {
  display: flex;
  gap: 8px;
  margin: 0 auto 0 28px;
}

@media (max-width: 920px) {
  header {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  header nav {
    order: 3;
    width: 100%;
    margin: 0;
    overflow-x: auto;
  }
}

@media (max-width: 720px) {
  .similar-head {
    display: none;
  }

  .similar-row {
    grid-template-columns: 1fr auto auto;
  }

  .similar-row > span:nth-child(4) {
    grid-column: 1 / 3;
    color: var(--muted);
    font-size: 12px;
  }

  .similar-row .arrow {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

header nav a {
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

header nav a:hover {
  color: var(--ink);
  background: var(--card);
}

.directory-header,
.user-profile {
  display: flex;
  align-items: end;
  gap: 24px;
  margin-bottom: 28px;
}

.directory-header > div,
.user-profile > div:first-child {
  flex: 1;
}

.user-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(440px, 100%);
}

.user-search input {
  min-width: 0;
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.user-search a {
  color: var(--green);
  font-weight: 700;
}

.users-head,
.user-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) .5fr minmax(260px, 1.2fr) 40px;
  gap: 18px;
  align-items: center;
  padding: 15px 20px;
}

.users-head {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.user-row {
  color: inherit;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.user-row:last-child {
  border-bottom: 0;
}

.user-row:hover {
  background: #f7f6ef;
}

.user-row > span:first-child,
.user-row > span:nth-child(3) {
  display: flex;
  flex-direction: column;
}

.user-row small {
  color: var(--muted);
}

.profile-stat {
  min-width: 125px;
  padding: 18px;
  border-radius: 16px;
  color: white;
  background: var(--ink);
}

.profile-stat strong {
  display: block;
  font: 700 28px Georgia, serif;
}

.profile-stat span {
  color: #b9c1bc;
  font-size: 12px;
}

.blocked-state {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  color: var(--red);
}

.blocked-state form {
  margin: 0;
}

.history-section {
  margin-top: 34px;
}

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

.section-title h2 {
  margin: 0;
  font: 700 27px Georgia, serif;
}

.section-title > span {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--lime);
  font-weight: 800;
}

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

.sanction {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.sanction > div {
  display: flex;
  flex-direction: column;
}

.sanction span,
.sanction p,
.sanction small {
  color: var(--muted);
  margin: 0;
}

.sanction a {
  margin-top: 5px;
  color: var(--green);
  font-weight: 700;
}

.sanction .moderation-duplicates {
  flex-basis: 100%;
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.moderation-duplicates h3 {
  margin: 0;
  font-size: 15px;
}

.moderation-duplicate {
  padding: 12px;
  border-radius: 10px;
  background: var(--paper);
}

.moderation-duplicate .message-media {
  margin-top: 10px;
}

.moderation-duplicate-text {
  white-space: pre-wrap;
}

.sanction-warn { border-left: 4px solid #f5c45d; }
.sanction-ban,
.sanction-community_ban { border-left: 4px solid var(--red); }
.sanction-unban { border-left: 4px solid var(--green); }

.votes-head,
.vote-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.7fr) minmax(150px, .8fr) minmax(120px, .7fr) minmax(135px, .8fr) 36px;
  gap: 18px;
  align-items: center;
  padding: 15px 20px;
}

.votes-head {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.vote-row {
  border-bottom: 1px solid var(--line);
}

.vote-row:last-child {
  border-bottom: 0;
}

.vote-row > span:first-child,
.vote-row > span:nth-child(3) {
  display: flex;
  flex-direction: column;
}

.vote-row a {
  color: var(--ink);
  text-decoration: none;
}

.vote-row a:hover {
  color: var(--green);
}

.vote-row small {
  color: var(--muted);
}

.vote-counts {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  flex-wrap: wrap;
}

.voter-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.voter-group small {
  overflow-wrap: anywhere;
}

.vote-yes,
.vote-no,
.vote-status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.vote-yes,
.status-passed {
  background: var(--lime);
}

.vote-no {
  background: #f0ddd8;
  color: var(--red);
}

.status-open {
  background: #f5c45d;
}

.status-failed {
  background: var(--line);
}

.vote-row .telegram-link {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-size: 18px;
}

@media (max-width: 720px) {
  .messages-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  header {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  header nav {
    order: 3;
    width: 100%;
    margin: 0;
  }

  .directory-header,
  .user-profile {
    align-items: stretch;
    flex-direction: column;
  }

  .user-search {
    min-width: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .users-head {
    display: none;
  }

  .user-row {
    grid-template-columns: 1fr auto;
  }

  .user-row > span:nth-child(3) {
    grid-column: 1;
    font-size: 12px;
  }

  .user-row .arrow {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .sanction {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .votes-hero .stat:last-child {
    display: none;
  }

  .votes-head {
    display: none;
  }

  .vote-row {
    grid-template-columns: 1fr auto;
  }

  .vote-row > span:nth-child(2),
  .vote-row > span:nth-child(3),
  .vote-row > span:nth-child(4) {
    grid-column: 1;
  }

  .vote-row > span:last-child {
    grid-column: 2;
    grid-row: 1 / 5;
  }
}
