:root {
  --accent: #f97820;
  --accent-dark: #d95d08;
  --accent-soft: #fff0e5;
  --background: #f3f4f6;
  --surface: #ffffff;
  --text: #1e232a;
  --muted: #707783;
  --border: #e3e5e9;
  --danger: #b42318;
  --danger-bg: #fff1ef;
  --success: #248247;
  --shadow: 0 25px 70px rgba(30, 36, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, #ffecde 0, transparent 32%),
    var(--background);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: var(--accent-dark);
  font-weight: 750;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.logo {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(249, 120, 32, 0.24);
  font-size: 24px;
  font-weight: 900;
}

.brand-name {
  display: block;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.6px;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 500px) 1fr;
}

.auth-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--border);
}

.auth-card {
  width: 100%;
  max-width: 375px;
}

.auth-card h1 {
  margin: 45px 0 9px;
  font-size: 31px;
  line-height: 1.15;
  letter-spacing: -1px;
}

.lead {
  margin: 0 0 27px;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  margin-top: 17px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  color: var(--text);
  background: white;
  border: 1px solid #d7d9de;
  border-radius: 14px;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 120, 32, 0.12);
}

.help {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.primary-button {
  width: 100%;
  min-height: 51px;
  margin-top: 24px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 12px 25px rgba(249, 120, 32, 0.22);
  cursor: pointer;
  font-weight: 900;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.auth-footer {
  margin-top: 21px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.alert {
  margin: 19px 0;
  padding: 13px 15px;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid #ffd2cc;
  border-radius: 13px;
  font-size: 13px;
  line-height: 1.5;
}

.auth-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 55px;
}

.auth-visual::before,
.auth-visual::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(249, 120, 32, 0.12);
}

.auth-visual::before {
  width: 430px;
  height: 430px;
  top: -160px;
  right: -110px;
}

.auth-visual::after {
  width: 280px;
  height: 280px;
  bottom: -140px;
  left: 4%;
}

.preview {
  position: relative;
  z-index: 2;
  width: min(790px, 100%);
  height: 555px;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.preview-sidebar {
  padding: 22px 16px;
  background: #fafafa;
  border-right: 1px solid var(--border);
}

.preview-title {
  padding: 2px 7px 18px;
  font-size: 21px;
  font-weight: 900;
}

.preview-search {
  height: 42px;
  margin-bottom: 15px;
  padding: 0 14px;
  color: var(--muted);
  background: #eff0f2;
  border-radius: 13px;
  font-size: 13px;
  line-height: 42px;
}

.person {
  display: flex;
  gap: 11px;
  padding: 11px 9px;
  border-radius: 14px;
}

.person.active {
  background: var(--accent-soft);
}

.avatar {
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  color: white;
  background: #555e6a;
  border-radius: 50%;
  font-weight: 900;
}

.person.active .avatar {
  background: var(--accent);
}

.person strong,
.person span {
  display: block;
}

.person strong {
  margin-top: 2px;
  font-size: 14px;
}

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

.preview-chat {
  display: grid;
  grid-template-rows: 72px 1fr 78px;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
}

.preview-header small {
  display: block;
  margin-top: 3px;
  color: var(--success);
}

.preview-messages {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 11px;
  padding: 27px;
  background:
    linear-gradient(rgba(255,255,255,.93), rgba(255,255,255,.93)),
    radial-gradient(circle, #ffe5d2, white);
}

.bubble {
  max-width: 78%;
  padding: 12px 15px;
  background: #edf0f3;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
}

.bubble.mine {
  align-self: flex-end;
  color: white;
  background: var(--accent);
  border-bottom-right-radius: 6px;
}

.bubble.theirs {
  border-bottom-left-radius: 6px;
}

.preview-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.preview-input {
  flex: 1;
  height: 46px;
  padding: 0 15px;
  color: var(--muted);
  background: #f0f1f3;
  border-radius: 24px;
  line-height: 46px;
  font-size: 13px;
}

.send-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
}

.app-page {
  min-height: 100vh;
  padding: 22px;
}

.app-shell {
  width: min(1450px, 100%);
  height: calc(100vh - 44px);
  min-height: 630px;
  display: grid;
  grid-template-columns: 280px 350px 1fr;
  margin: auto;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.navigation {
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: #f8f8f9;
  border-right: 1px solid var(--border);
}

.navigation .brand {
  padding: 0 7px 25px;
}

.menu {
  display: grid;
  gap: 7px;
}

.menu-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  color: var(--text);
  border-radius: 13px;
  font-size: 14px;
  font-weight: 750;
}

.menu-item:hover {
  background: #ededf0;
  text-decoration: none;
}

.menu-item.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.menu-icon {
  width: 24px;
  text-align: center;
  font-size: 18px;
}

.badge {
  margin-left: auto;
  padding: 3px 7px;
  color: var(--muted);
  background: #e9eaed;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-box {
  margin-top: auto;
  padding: 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-row .avatar {
  background: var(--accent);
}

.account-data {
  min-width: 0;
}

.account-data strong,
.account-data span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-data strong {
  font-size: 13px;
}

.account-data span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.logout-form {
  margin-top: 13px;
}

.secondary-button {
  width: 100%;
  min-height: 39px;
  color: var(--text);
  background: #f1f2f4;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
}

.conversations {
  padding: 23px 16px;
  background: white;
  border-right: 1px solid var(--border);
}

.conversations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 17px;
}

.conversations-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.round-button {
  width: 38px;
  height: 38px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  font-size: 22px;
}

.conversation-search {
  height: 43px;
  padding: 0 14px;
  color: var(--muted);
  background: #f0f1f3;
  border-radius: 13px;
  line-height: 43px;
  font-size: 13px;
}

.empty-list {
  margin-top: 18px;
  padding: 22px;
  color: var(--muted);
  background: #fafafa;
  border: 1px dashed #d8dbe0;
  border-radius: 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
}

.chat {
  display: grid;
  grid-template-rows: 73px 1fr;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  border-bottom: 1px solid var(--border);
}

.security-label {
  padding: 7px 11px;
  color: var(--muted);
  background: #f1f2f4;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.chat-empty {
  display: grid;
  place-items: center;
  padding: 35px;
  background:
    linear-gradient(rgba(255,255,255,.94), rgba(255,255,255,.94)),
    radial-gradient(circle, #ffe5d2, white);
}

.welcome-card {
  width: min(510px, 100%);
  padding: 38px;
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 23px;
  box-shadow: 0 18px 48px rgba(30, 36, 44, 0.09);
}

.welcome-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 19px;
  color: white;
  background: var(--accent);
  border-radius: 21px;
  font-size: 29px;
  font-weight: 900;
}

.welcome-card h2 {
  margin: 0 0 11px;
  font-size: 25px;
}

.welcome-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-list {
  display: grid;
  gap: 10px;
  margin-top: 23px;
  text-align: left;
}

.status-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: #f8f8f9;
  border-radius: 12px;
  font-size: 13px;
}

.status-ok {
  color: var(--success);
  font-weight: 900;
}

.status-wait {
  color: var(--accent-dark);
  font-weight: 900;
}

.profile-page {
  min-height: 100vh;
  padding: 35px 20px;
}

.profile-card {
  width: min(650px, 100%);
  margin: auto;
  padding: 30px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.profile-card h1 {
  margin: 28px 0 20px;
}

.profile-row {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.profile-row span,
.profile-row strong {
  display: block;
}

.profile-row span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.back-link {
  display: inline-block;
  margin-top: 25px;
}

@media (max-width: 1050px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .app-shell {
    grid-template-columns: 235px 310px 1fr;
  }
}

@media (max-width: 800px) {
  .app-page {
    padding: 0;
  }

  .app-shell {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    grid-template-columns: 88px 1fr;
    border: 0;
    border-radius: 0;
  }

  .navigation {
    padding: 18px 10px;
  }

  .navigation .brand {
    justify-content: center;
    padding: 0 0 22px;
  }

  .brand-name,
  .brand-subtitle,
  .menu-item span:not(.menu-icon),
  .badge,
  .account-data,
  .logout-form {
    display: none;
  }

  .menu-item {
    justify-content: center;
    padding: 0;
  }

  .account-box {
    display: flex;
    justify-content: center;
    padding: 10px;
  }

  .conversations {
    border-right: 0;
  }

  .chat {
    display: none;
  }
}

@media (max-width: 500px) {
  .auth-panel {
    align-items: flex-start;
    padding: 28px 22px;
  }

  .auth-card h1 {
    margin-top: 36px;
  }

  .app-shell {
    grid-template-columns: 74px 1fr;
  }
}

/* MUNIT FRIENDS MODULE */

.friends-page {
  min-height: 100vh;
  padding: 28px 20px;
}

.friends-shell {
  width: min(1100px, 100%);
  margin: auto;
}

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

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

.people-back {
  padding: 11px 16px;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: 13px;
}

.people-back:hover {
  background: #f6f6f7;
  text-decoration: none;
}

.friends-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 24px;
}

.friends-intro h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -1px;
}

.friends-intro p {
  margin: 8px 0 0;
  color: var(--muted);
}

.friends-counter {
  min-width: 110px;
  padding: 15px 20px;
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 17px;
}

.friends-counter strong,
.friends-counter span {
  display: block;
}

.friends-counter strong {
  color: var(--accent-dark);
  font-size: 25px;
}

.friends-counter span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

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

.friends-section {
  margin-bottom: 22px;
  padding: 22px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 35px rgba(30, 36, 44, 0.06);
}

.friends-section h2 {
  margin: 0 0 17px;
  font-size: 18px;
}

.friends-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.friends-section-heading h2 {
  margin: 0 0 17px;
}

.people-count {
  min-width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  margin-bottom: 17px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}

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

.people-search-form input {
  min-width: 0;
  height: 48px;
  padding: 0 15px;
  color: var(--text);
  background: #f5f5f7;
  border: 1px solid transparent;
  border-radius: 14px;
  outline: none;
}

.people-search-form input:focus {
  background: white;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 120, 32, 0.11);
}

.people-search-form button {
  min-width: 110px;
  padding: 0 20px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 850;
}

.people-list {
  display: grid;
  gap: 10px;
  margin-top: 17px;
}

.people-list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.people-card {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px;
  background: #fafafa;
  border: 1px solid #eeeeef;
  border-radius: 15px;
}

.people-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.people-avatar {
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-weight: 900;
}

.people-name {
  min-width: 0;
}

.people-name strong,
.people-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.people-name strong {
  font-size: 14px;
}

.people-name span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.people-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.people-actions form {
  margin: 0;
}

.people-button {
  min-height: 36px;
  padding: 0 12px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.people-button:hover {
  background: var(--accent-dark);
}

.people-button-secondary {
  color: var(--text);
  background: #e9eaed;
}

.people-button-secondary:hover {
  background: #dbdde1;
}

.people-button-danger {
  color: #a5281d;
  background: #ffebe8;
}

.people-button-danger:hover {
  background: #ffd8d3;
}

.people-relation {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.people-relation-success {
  color: var(--success);
}

.people-empty {
  padding: 21px;
  color: var(--muted);
  background: #fafafa;
  border: 1px dashed #d9dbe0;
  border-radius: 14px;
  text-align: center;
  font-size: 13px;
}

.people-notice {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
}

.people-notice-success {
  color: #1e7540;
  background: #e9f8ef;
  border: 1px solid #c5ead2;
}

.people-notice-info {
  color: #8a4a12;
  background: #fff3e8;
  border: 1px solid #ffdabb;
}

.people-notice-error {
  color: #a1261d;
  background: #fff0ee;
  border: 1px solid #ffd0cb;
}

@media (max-width: 850px) {
  .friends-grid,
  .people-list-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .friends-page {
    padding: 20px 13px;
  }

  .friends-header,
  .friends-intro {
    align-items: flex-start;
  }

  .friends-intro {
    flex-direction: column;
  }

  .friends-counter {
    display: none;
  }

  .friends-section {
    padding: 16px;
  }

  .people-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .people-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .people-search-form button {
    min-height: 46px;
  }
}

/* MUNIT FRIENDS INTEGRATED UI V3 */

.friends-app-shell {
  grid-template-columns: 280px 1fr;
}

.friends-main-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #f6f7f9;
}

.friends-app-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 20px 28px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.friends-app-header h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.7px;
}

.friends-app-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.friends-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

.friends-search-section {
  position: relative;
}

.friends-search-section::before {
  content: "";
  position: absolute;
  width: 4px;
  top: 20px;
  bottom: 20px;
  left: 0;
  background: var(--accent);
  border-radius: 0 5px 5px 0;
}

.menu-counter {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 0 6px;
  color: white;
  background: var(--accent);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}

.blocked-details {
  margin-bottom: 24px;
}

.blocked-details summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 20px;
  color: var(--muted);
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.blocked-details summary span {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: #eceef1;
  border-radius: 999px;
  font-size: 10px;
}

.blocked-details[open] summary {
  margin-bottom: 12px;
}

.blocked-details .friends-section {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .friends-app-shell {
    grid-template-columns: 90px 1fr;
  }

  .friends-app-shell .navigation {
    padding: 18px 10px;
  }

  .friends-app-shell .navigation .brand {
    justify-content: center;
    padding: 0 0 22px;
  }

  .friends-app-shell .brand-name,
  .friends-app-shell .brand-subtitle,
  .friends-app-shell .menu-item span:not(.menu-icon):not(.menu-counter),
  .friends-app-shell .account-data,
  .friends-app-shell .logout-form {
    display: none;
  }

  .friends-app-shell .menu-item {
    justify-content: center;
    padding: 0;
  }

  .friends-app-shell .menu-counter {
    position: absolute;
    margin: -28px 0 0 31px;
  }

  .friends-app-shell .account-box {
    display: flex;
    justify-content: center;
    padding: 10px;
  }
}

@media (max-width: 650px) {
  .friends-app-shell {
    grid-template-columns: 72px 1fr;
  }

  .friends-app-header {
    min-height: 80px;
    padding: 15px 17px;
  }

  .friends-app-header h1 {
    font-size: 21px;
  }

  .friends-app-header p,
  .friends-counter {
    display: none;
  }

  .friends-scroll {
    padding: 16px 12px 30px;
  }

  .friends-grid,
  .people-list-grid {
    grid-template-columns: 1fr;
  }

  .friends-section {
    padding: 15px;
    border-radius: 16px;
  }

  .people-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .people-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* MUNIT CONTACTS LAYOUT V4 */

.contacts-page {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
}

.friends-app-shell.contacts-layout {
  width: min(1540px, 100%);
  height: calc(100dvh - 32px);
  min-height: 0;
  grid-template-columns:
    215px
    330px
    minmax(0, 1fr);
  overflow: hidden;
}

.contacts-navigation {
  min-height: 0;
}

.contacts-sidebar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows:
    auto
    auto
    auto
    minmax(0, 1fr);
  background: #ffffff;
  border-right: 1px solid var(--border);
}

.contacts-sidebar-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 12px;
}

.contacts-sidebar-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.6px;
}

.contacts-sidebar-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.contacts-add-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 13px;
  font-size: 24px;
  font-weight: 500;
  text-decoration: none;
}

.contacts-add-button:hover {
  color: white;
  background: var(--accent-dark);
  text-decoration: none;
}

.contacts-filter {
  padding: 0 16px 12px;
}

.contacts-filter input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  color: var(--text);
  background: #f1f2f4;
  border: 1px solid transparent;
  border-radius: 13px;
  outline: none;
}

.contacts-filter input:focus {
  background: white;
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px rgba(249, 120, 32, 0.10);
}

.invitations-shortcut {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 10px 9px;
  padding: 11px;
  color: var(--text);
  background: #fff7f0;
  border-radius: 14px;
  text-decoration: none;
}

.invitations-shortcut:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.invitations-icon {
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-size: 20px;
}

.invitations-shortcut > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.invitations-shortcut strong,
.invitations-shortcut small {
  display: block;
}

.invitations-shortcut strong {
  font-size: 13px;
}

.invitations-shortcut small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.invitations-shortcut b {
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 999px;
  font-size: 10px;
}

.contacts-list {
  min-height: 0;
  overflow-y: auto;
  padding: 0 9px 18px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.contact-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 10px;
  color: var(--text);
  border-radius: 14px;
  text-decoration: none;
}

.contact-row:hover {
  background: #f3f4f6;
  text-decoration: none;
}

.contact-row-active {
  background: var(--accent-soft);
}

.contact-row-active:hover {
  background: var(--accent-soft);
}

.contact-avatar {
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
}

.contact-data {
  min-width: 0;
  flex: 1;
}

.contact-data strong,
.contact-data small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-data strong {
  font-size: 13px;
}

.contact-data small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.contact-arrow {
  color: #a1a6ae;
  font-size: 20px;
}

.contacts-empty {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
}

.contacts-empty div {
  margin-bottom: 10px;
  font-size: 27px;
}

.contacts-empty strong,
.contacts-empty span {
  display: block;
}

.contacts-empty strong {
  color: var(--text);
  font-size: 13px;
}

.contacts-empty span {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
}

.contacts-layout .friends-main-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.contacts-layout .friends-app-header {
  min-height: 82px;
  padding: 17px 25px;
}

.contacts-layout .friends-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 20px 24px 36px;
}

.selected-contact-panel {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 18px;
  padding: 20px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 19px;
  box-shadow:
    0 10px 30px rgba(30, 36, 44, 0.05);
}

.selected-contact-avatar {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-size: 22px;
  font-weight: 900;
}

.selected-contact-data {
  min-width: 0;
  flex: 1;
}

.selected-contact-data span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.selected-contact-data h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.selected-contact-data p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.selected-contact-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.selected-contact-actions form {
  margin: 0;
}

.contact-message-button {
  min-height: 36px;
  padding: 0 14px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 850;
}

.contact-message-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 1100px) {
  .friends-app-shell.contacts-layout {
    grid-template-columns:
      82px
      300px
      minmax(0, 1fr);
  }

  .contacts-navigation {
    padding: 18px 9px;
  }

  .contacts-navigation .brand {
    justify-content: center;
    padding: 0 0 22px;
  }

  .contacts-navigation .brand-name,
  .contacts-navigation .brand-subtitle,
  .contacts-navigation .menu-item span:not(.menu-icon):not(.menu-counter),
  .contacts-navigation .account-data,
  .contacts-navigation .logout-form {
    display: none;
  }

  .contacts-navigation .menu-item {
    justify-content: center;
    padding: 0;
  }

  .contacts-navigation .account-box {
    display: flex;
    justify-content: center;
    padding: 9px;
  }
}

@media (max-width: 780px) {
  .contacts-page {
    padding: 0;
  }

  .friends-app-shell.contacts-layout {
    width: 100%;
    height: 100dvh;
    grid-template-columns:
      68px
      minmax(230px, 1fr);
    border: 0;
    border-radius: 0;
  }

  .contacts-sidebar {
    border-right: 0;
  }

  .contacts-layout .friends-main-panel {
    display: none;
  }
}

@media (max-width: 430px) {
  .friends-app-shell.contacts-layout {
    grid-template-columns:
      58px
      minmax(0, 1fr);
  }

  .contacts-sidebar-header {
    padding-left: 13px;
    padding-right: 13px;
  }

  .contacts-filter {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* MUNIT SECURITY STAGE 3A */

.security-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px 20px;
  background:
    radial-gradient(
      circle at top right,
      #ffeadb 0,
      transparent 34%
    ),
    #f3f4f6;
}

.security-card {
  width: min(470px, 100%);
  padding: 34px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.security-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 38px auto 19px;
  background: var(--accent-soft);
  border-radius: 21px;
  font-size: 30px;
}

.security-card h1 {
  margin: 0;
  text-align: center;
  font-size: 27px;
  letter-spacing: -0.7px;
}

.security-lead {
  margin: 11px auto 25px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  font-size: 13px;
}

.security-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.security-info {
  display: grid;
  gap: 5px;
  margin-top: 24px;
  padding: 15px;
  color: var(--muted);
  background: #f7f8f9;
  border-radius: 14px;
  font-size: 11px;
  line-height: 1.5;
}

.security-info strong {
  color: var(--text);
  font-size: 12px;
}

.security-message {
  margin: 18px 0;
  padding: 13px 15px;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.5;
}

.security-message-error {
  color: #a1261d;
  background: #fff0ee;
  border: 1px solid #ffd0cb;
}

.security-message-success {
  color: #1e7540;
  background: #e9f8ef;
  border: 1px solid #c5ead2;
}

@media (max-width: 520px) {
  .security-page {
    align-items: start;
    padding: 16px 10px;
  }

  .security-card {
    padding: 24px 19px;
    border-radius: 19px;
  }

  .security-icon {
    margin-top: 29px;
  }
}

/* MUNIT CHAT BUTTON V6 */

.contact-message-form {
  margin: 0;
}

.contact-message-button {
  cursor: pointer;
  box-shadow:
    0 8px 18px rgba(249, 120, 32, 0.18);
}

.contact-message-button:hover {
  background: var(--accent-dark);
}

.contact-message-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* MUNIT CHAT UI V7 */

.chat-page {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
  background: #eceef1;
}

.chat-shell {
  width: min(1580px, 100%);
  height: calc(100dvh - 32px);
  min-height: 0;
  display: grid;
  grid-template-columns:
    215px
    340px
    minmax(0, 1fr);
  margin: 0 auto;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.chat-navigation {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: white;
  border-right: 1px solid var(--border);
}

.chat-navigation .account-box {
  margin-top: auto;
}

.chat-conversations-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows:
    auto
    auto
    minmax(0, 1fr);
  background: #ffffff;
  border-right: 1px solid var(--border);
}

.chat-list-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 12px;
}

.chat-list-header h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.7px;
}

.chat-list-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.chat-new-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 13px;
  font-size: 24px;
  text-decoration: none;
}

.chat-new-button:hover {
  color: white;
  background: var(--accent-dark);
  text-decoration: none;
}

.chat-search {
  padding: 0 15px 12px;
}

.chat-search input {
  width: 100%;
  height: 43px;
  padding: 0 14px;
  color: var(--text);
  background: #f1f2f4;
  border: 1px solid transparent;
  border-radius: 13px;
  outline: none;
}

.chat-search input:focus {
  background: white;
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px rgba(249, 120, 32, 0.1);
}

.chat-conversation-list {
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 16px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.chat-conversation-row {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns:
    47px
    minmax(0, 1fr)
    auto;
  align-items: center;
  gap: 11px;
  padding: 11px 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  text-align: left;
}

.chat-conversation-row:hover {
  background: #f3f4f6;
}

.chat-conversation-row-active {
  background: var(--accent-soft);
}

.chat-conversation-row-active:hover {
  background: var(--accent-soft);
}

.chat-conversation-avatar,
.chat-peer-avatar {
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-weight: 900;
}

.chat-conversation-avatar {
  width: 47px;
  height: 47px;
  font-size: 15px;
}

.chat-conversation-data {
  min-width: 0;
}

.chat-conversation-data strong,
.chat-conversation-data small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-data strong {
  font-size: 13px;
}

.chat-conversation-data small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.chat-conversation-row time {
  align-self: start;
  padding-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.chat-list-loading,
.chat-list-empty {
  padding: 34px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.chat-list-empty div {
  margin-bottom: 10px;
  font-size: 28px;
}

.chat-list-empty strong,
.chat-list-empty span,
.chat-list-empty a {
  display: block;
}

.chat-list-empty strong {
  color: var(--text);
  font-size: 13px;
}

.chat-list-empty span {
  margin-top: 6px;
  line-height: 1.5;
}

.chat-list-empty a {
  margin-top: 13px;
  color: var(--accent-dark);
  font-weight: 800;
}

.chat-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto
    auto;
  background:
    radial-gradient(
      circle at top right,
      rgba(249, 120, 32, 0.055),
      transparent 34%
    ),
    #f4f5f7;
  overflow: hidden;
}

.chat-panel-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 19px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.chat-mobile-back {
  display: none;
  width: 37px;
  height: 37px;
  place-items: center;
  color: var(--text);
  background: #f0f1f3;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 18px;
}

.chat-peer-avatar {
  flex: 0 0 auto;
  width: 45px;
  height: 45px;
  font-size: 15px;
}

.chat-peer-data {
  min-width: 0;
  flex: 1;
}

.chat-peer-data strong,
.chat-peer-data span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-peer-data strong {
  font-size: 14px;
}

.chat-peer-data span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.chat-security-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #32734d;
  background: #e8f7ee;
  border: 1px solid #c8e9d4;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
}

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px clamp(16px, 4vw, 55px);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.chat-empty-state,
.chat-key-warning,
.chat-loading-conversation,
.chat-start-message {
  height: 100%;
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.chat-empty-icon {
  margin-bottom: 13px;
  font-size: 41px;
}

.chat-empty-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 23px;
}

.chat-empty-state p {
  max-width: 390px;
  margin: 9px 0 17px;
  line-height: 1.6;
  font-size: 12px;
}

.chat-empty-state a {
  padding: 10px 15px;
  color: white;
  background: var(--accent);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}

.chat-start-message {
  min-height: 170px;
}

.chat-start-message div,
.chat-key-warning div {
  margin-bottom: 10px;
  font-size: 28px;
}

.chat-start-message strong,
.chat-start-message span,
.chat-key-warning strong,
.chat-key-warning span {
  display: block;
}

.chat-start-message strong,
.chat-key-warning strong {
  color: var(--text);
  font-size: 13px;
}

.chat-start-message span,
.chat-key-warning span {
  max-width: 420px;
  margin-top: 6px;
  line-height: 1.5;
  font-size: 11px;
}

.chat-message {
  display: flex;
  margin: 7px 0;
}

.chat-message-mine {
  justify-content: flex-end;
}

.chat-message-peer {
  justify-content: flex-start;
}

.chat-message-bubble {
  max-width: min(72%, 680px);
  padding: 10px 12px 7px;
  border-radius: 16px;
  box-shadow:
    0 4px 14px rgba(30, 36, 44, 0.06);
}

.chat-message-mine .chat-message-bubble {
  color: #45200b;
  background: #ffd8bc;
  border-bottom-right-radius: 5px;
}

.chat-message-peer .chat-message-bubble {
  color: var(--text);
  background: white;
  border-bottom-left-radius: 5px;
}

.chat-message-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.48;
}

.chat-message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  color: rgba(48, 51, 57, 0.58);
  font-size: 8px;
}

.chat-message-status {
  font-size: 10px;
}

.chat-message-broken {
  max-width: 420px;
  margin: 12px auto;
  padding: 10px 13px;
  color: #9c2d23;
  background: #fff0ee;
  border: 1px solid #ffd0cb;
  border-radius: 12px;
  text-align: center;
  font-size: 10px;
}

.chat-compose {
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    46px;
  align-items: end;
  gap: 9px;
  padding: 13px 17px 27px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.chat-compose[hidden] {
  display: none;
}

.chat-compose textarea {
  width: 100%;
  min-height: 46px;
  max-height: 140px;
  resize: none;
  overflow-y: auto;
  padding: 13px 15px;
  color: var(--text);
  background: #f1f2f4;
  border: 1px solid transparent;
  border-radius: 15px;
  outline: none;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.chat-compose textarea:focus {
  background: white;
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px rgba(249, 120, 32, 0.1);
}

.chat-send-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-size: 18px;
  box-shadow:
    0 8px 20px rgba(249, 120, 32, 0.24);
}

.chat-send-button:hover {
  background: var(--accent-dark);
}

.chat-send-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.chat-compose-hint {
  position: absolute;
  bottom: 8px;
  left: 20px;
  color: var(--muted);
  font-size: 8px;
}

.chat-error {
  margin: 0 17px 10px;
  padding: 10px 13px;
  color: #a1261d;
  background: #fff0ee;
  border: 1px solid #ffd0cb;
  border-radius: 12px;
  font-size: 10px;
}

.chat-loading-spinner {
  width: 27px;
  height: 27px;
  margin-bottom: 12px;
  border: 3px solid #e3e5e8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
}

.chat-loading-conversation span {
  font-size: 11px;
}

@keyframes chat-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .chat-shell {
    grid-template-columns:
      82px
      310px
      minmax(0, 1fr);
  }

  .chat-navigation {
    padding: 18px 9px;
  }

  .chat-navigation .brand {
    justify-content: center;
    padding: 0 0 22px;
  }

  .chat-navigation .brand-name,
  .chat-navigation .brand-subtitle,
  .chat-navigation .menu-item span:not(.menu-icon),
  .chat-navigation .account-data,
  .chat-navigation .logout-form {
    display: none;
  }

  .chat-navigation .menu-item {
    justify-content: center;
    padding: 0;
  }

  .chat-navigation .account-box {
    display: flex;
    justify-content: center;
    padding: 9px;
  }
}

@media (max-width: 780px) {
  .chat-page {
    padding: 0;
  }

  .chat-shell {
    width: 100%;
    height: 100dvh;
    grid-template-columns:
      64px
      minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }

  .chat-panel {
    display: none;
  }

  .chat-shell.chat-has-active {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .chat-shell.chat-has-active .chat-navigation,
  .chat-shell.chat-has-active
    .chat-conversations-column {
    display: none;
  }

  .chat-shell.chat-has-active .chat-panel {
    display: grid;
  }

  .chat-mobile-back {
    display: grid;
  }

  .chat-security-badge {
    display: none;
  }

  .chat-messages {
    padding:
      18px
      12px;
  }

  .chat-message-bubble {
    max-width: 86%;
  }

  .chat-compose {
    padding:
      10px
      10px
      max(25px, env(safe-area-inset-bottom));
  }

  .chat-compose-hint {
    display: none;
  }
}

@media (max-width: 430px) {
  .chat-shell {
    grid-template-columns:
      56px
      minmax(0, 1fr);
  }

  .chat-list-header {
    padding-left: 13px;
    padding-right: 13px;
  }

  .chat-search {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chat-conversation-list {
    padding-left: 4px;
    padding-right: 4px;
  }
}
