:root {
  color-scheme: dark;
  --background: #090a0f;
  --surface: rgba(20, 21, 31, 0.88);
  --surface-border: rgba(255, 255, 255, 0.1);
  --text: #f7f7fc;
  --muted: #a8a9bb;
  --input: #191a25;
  --input-border: #343545;
  --accent-start: #8864ff;
  --accent-end: #3c8cff;
  --danger: #ff8395;
  --success: #8ee5b1;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(117, 74, 255, 0.24), transparent 34rem),
    radial-gradient(circle at 100% 100%, rgba(38, 122, 255, 0.18), transparent 30rem),
    var(--background);
}

button,
input {
  font: inherit;
}

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

.auth-card {
  width: min(100%, 420px);
  padding: 32px;
  border: 1px solid var(--surface-border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand__icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  box-shadow: 0 10px 30px rgba(93, 103, 255, 0.35);
  font-size: 24px;
}

.brand__eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1;
}

.intro {
  margin: 34px 0 24px;
}

h2 {
  margin-bottom: 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.intro p,
.privacy-note {
  color: var(--muted);
  line-height: 1.55;
}

.intro p {
  margin-bottom: 0;
}

.field {
  margin-top: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #d7d8e8;
  font-size: 13px;
  font-weight: 650;
}

input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--input-border);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: var(--input);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
  color: #787a8e;
}

input:focus {
  border-color: #8b73ff;
  box-shadow: 0 0 0 4px rgba(133, 102, 255, 0.18);
}

.primary-button {
  width: 100%;
  margin-top: 24px;
  padding: 14px 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  box-shadow: 0 12px 28px rgba(87, 96, 255, 0.24);
  cursor: pointer;
  font-weight: 750;
  transition: filter 150ms ease, transform 150ms ease;
}

.primary-button:hover {
  filter: brightness(1.1);
}

.primary-button:active {
  transform: translateY(1px);
}

.form-message {
  min-height: 20px;
  margin: 14px 0 -10px;
  color: var(--danger);
  font-size: 13px;
}

.form-message.success {
  color: var(--success);
}

.switch-copy {
  margin: 23px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.text-button {
  padding: 0;
  border: 0;
  color: #a994ff;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.privacy-note {
  margin: 25px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--surface-border);
  font-size: 12px;
  text-align: center;
}

.auth-card.is-login .register-only,
.auth-card.is-login .invite-only,
.auth-card.is-login #name-label,
.auth-card.is-login #name {
  display: none;
}

@media (max-width: 460px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-card {
    padding: 26px 22px;
    border-radius: 22px;
  }
}


.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}






.app-body {
  overflow: hidden;
}

.chat-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(280px, 340px) 1fr;
}

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 20px;
  border-right: 1px solid var(--surface-border);
  background: rgba(12, 13, 20, 0.8);
  backdrop-filter: blur(18px);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.app-brand__icon,
.avatar,
.chat-empty-state__icon,
.empty-conversations__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  box-shadow: 0 8px 22px rgba(93, 103, 255, 0.25);
}

.app-brand__icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text);
  background: var(--input);
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.icon-button:hover,
.secondary-button:hover {
  border-color: #7967e8;
  background: #232435;
}

.icon-button--small {
  width: 34px;
  height: 34px;
  font-size: 19px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--muted);
  background: var(--input);
}

.search-box:focus-within {
  border-color: #8b73ff;
  box-shadow: 0 0 0 4px rgba(133, 102, 255, 0.14);
}

.search-box input {
  padding: 11px 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.search-box input:focus {
  box-shadow: none;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  margin: 24px -8px 0;
  padding: 0 8px;
}

.section-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-conversations {
  display: grid;
  justify-items: center;
  padding: 32px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.empty-conversations__icon {
  width: 35px;
  height: 35px;
  margin-bottom: 10px;
  border-radius: 12px;
  font-size: 16px;
}

.empty-conversations p {
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.secondary-button {
  padding: 9px 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: #d9d6ff;
  background: var(--input);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--surface-border);
}

.avatar {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-user__details {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.sidebar-user__details strong,
.sidebar-user__details span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user__details strong {
  font-size: 13px;
}

.sidebar-user__details span {
  color: var(--muted);
  font-size: 11px;
}

.chat-panel {
  display: grid;
  min-width: 0;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.chat-empty-state {
  width: min(100%, 480px);
  text-align: center;
}

.chat-empty-state__icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 22px;
  border-radius: 22px;
  font-size: 29px;
}

.chat-empty-state h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.04em;
}

.chat-empty-state p {
  margin-bottom: 26px;
  color: var(--muted);
  line-height: 1.65;
}

.chat-empty-state__button {
  width: auto;
  margin-top: 0;
}

@media (max-width: 700px) {
  .app-body {
    overflow: auto;
  }

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--surface-border);
  }

  .conversation-list {
    display: none;
  }

  .sidebar-user {
    display: none;
  }

  .chat-panel {
    min-height: calc(100vh - 122px);
  }
}






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

.admin-card {
  width: min(100%, 780px);
  padding: 32px;
  border: 1px solid var(--surface-border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-intro {
  margin: 40px 0 24px;
}

.admin-intro h1 {
  margin: 6px 0 10px;
  font-size: clamp(28px, 5vw, 38px);
  letter-spacing: -0.04em;
}

.admin-intro p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.invite-result {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(139, 115, 255, 0.35);
  border-radius: 16px;
  background: rgba(116, 91, 255, 0.09);
}

.invite-result__row {
  display: flex;
  gap: 10px;
}

.invite-result__row input {
  min-width: 0;
  padding: 11px 12px;
  font-size: 13px;
}

.invite-result__row .secondary-button {
  flex: 0 0 auto;
}

.invite-result p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.invite-history {
  margin-top: 34px;
  padding-top: 25px;
  border-top: 1px solid var(--surface-border);
}

.invite-history h2 {
  margin-bottom: 16px;
  font-size: 19px;
}

.invite-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--surface-border);
  text-align: left;
}

th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td {
  color: #d7d8e8;
}

@media (max-width: 520px) {
  .admin-shell {
    padding: 14px;
  }

  .admin-card {
    padding: 24px 18px;
    border-radius: 21px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .invite-result__row {
    flex-direction: column;
  }
}






.logout-button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: #dedcf0;
  background: var(--input);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.logout-button:hover {
  border-color: rgba(255, 131, 149, 0.7);
  color: #ffd9df;
  background: rgba(255, 131, 149, 0.1);
}

.logout-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 700px) {
  .logout-button {
    display: none;
  }
}



.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.contact-modal {
  width: min(100%, 520px);
  max-height: min(680px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 25px;
  border: 1px solid var(--surface-border);
  border-radius: 22px;
  background: #151621;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.contact-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.contact-modal__header h2 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.contact-modal .field {
  margin-top: 24px;
}

.contact-modal .field > span {
  display: block;
  margin-bottom: 8px;
  color: #d7d8e8;
  font-size: 13px;
  font-weight: 650;
}

.user-search-results {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.modal-hint {
  margin: 0;
  padding: 22px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.user-result {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.user-result strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.user-result .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 12px;
}

.user-result .secondary-button {
  flex: 0 0 auto;
}



.contact-requests {
  margin-top: 22px;
}

.contact-requests .section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.request-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: #7b63ff;
  font-size: 10px;
  font-weight: 800;
}

.contact-requests__list {
  display: grid;
  gap: 8px;
}

.request-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.request-item .avatar {
  width: 33px;
  height: 33px;
  border-radius: 11px;
  font-size: 11px;
}

.request-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.request-item__actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 7px;
}

.request-action {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid var(--input-border);
  border-radius: 9px;
  color: #d7d8e8;
  background: var(--input);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.request-action--accept {
  border-color: rgba(104, 212, 151, 0.35);
  color: #b8f6d1;
  background: rgba(83, 186, 127, 0.12);
}

.request-action:disabled {
  cursor: wait;
  opacity: 0.65;
}



.contacts-list {
  display: grid;
  gap: 6px;
}

.contact-list-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.contact-list-item:hover {
  border-color: var(--surface-border);
  background: rgba(255, 255, 255, 0.05);
}

.contact-list-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 12px;
}

.contact-list-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.sent-requests {
  margin: 16px 0 0;
}

.sent-requests__list {
  display: grid;
  gap: 6px;
}

.sent-request-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
}

.sent-request-item .avatar {
  width: 29px;
  height: 29px;
  border-radius: 10px;
  font-size: 10px;
}


.contact-list-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 13px;
}

.contact-list-item:hover {
  border-color: var(--surface-border);
  background: rgba(255, 255, 255, 0.05);
}

.contact-list-item__open {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 5px;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.contact-list-item__open .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 12px;
}

.contact-list-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.contact-remove-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.contact-remove-button:hover {
  border-color: rgba(255, 131, 149, 0.5);
  color: #ffd5dc;
  background: rgba(255, 131, 149, 0.12);
}

.contact-remove-button:disabled {
  cursor: wait;
  opacity: 0.6;
}