* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #f5f5f5;
  --muted: #c8c8c8;
  --line: #f5f5f5;
  --soft-line: #888;
  --panel: #020202;
  --panel-2: #101010;
  --accent: #ed1b24;
  --green: #00ff7f;
  --yellow: #ffe66d;
  --danger: #ff4545;
  --bubble: #232323;
  --bubble-own: #2b2b2b;
  --shadow: rgba(255, 255, 255, .12);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.topbar {
  min-height: 128px;
  display: flex;
  align-items: flex-start;
  padding: 32px 40px 18px;
  position: relative;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.brand__logo {
  width: 76px;
  height: 76px;
}

.brand__name {
  font-size: clamp(2rem, 3vw, 3.2rem);
  letter-spacing: -.04em;
  line-height: 1;
}

.prealpha {
  position: absolute;
  top: 2px;
  right: 0;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  color: var(--muted);
  padding-right: 0;
}

.gear {
  position: absolute;
  top: 44px;
  right: 28px;
  width: 74px;
  height: 74px;
  border: 0;
  background: transparent;
  font-size: 4.1rem;
  line-height: 1;
  cursor: pointer;
}

.settings-menu {
  position: absolute;
  right: 38px;
  top: 116px;
  min-width: 260px;
  z-index: 50;
  border: 2px solid var(--line);
  background: #050505;
  padding: 8px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .8);
}

.settings-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--fg);
  border: 0;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 1.05rem;
}

.settings-menu button:hover,
.settings-menu button:focus-visible {
  outline: 2px solid var(--line);
  background: #111;
}

.settings-menu .danger {
  color: var(--danger);
}

.stage {
  width: min(1210px, calc(100vw - 48px));
  margin: 0 auto 40px;
}

.screen {
  animation: enter .18s ease-out;
}

.screen--center {
  text-align: center;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  text-align: center;
  margin-bottom: 42px;
  letter-spacing: -.03em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 300;
  margin-bottom: 16px;
  letter-spacing: -.03em;
}

p {
  font-size: clamp(1.1rem, 2.05vw, 1.55rem);
  line-height: 1.35;
  color: var(--fg);
}

.metro-card {
  border: 2px solid var(--line);
  background: var(--panel);
}

.intro-card {
  width: min(900px, 100%);
  margin: 0 auto 44px;
  text-align: left;
  padding: 8px 10px 22px;
}

.wide-actions {
  display: flex;
  justify-content: center;
  gap: min(17vw, 216px);
  flex-wrap: wrap;
}

.metro-button {
  border: 2px solid var(--line);
  background: #030303;
  min-height: 54px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease, border-color .12s ease;
}

.metro-button:hover,
.metro-button:focus-visible {
  background: #121212;
  outline: 0;
}

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

.metro-button:disabled {
  color: #777;
  border-color: #777;
  cursor: not-allowed;
}

.metro-button--wide {
  width: min(300px, 100%);
  font-size: 1.45rem;
  min-height: 86px;
}

.metro-button--big {
  font-size: 2rem;
  min-width: 212px;
}

.metro-button--thin {
  min-height: 36px;
  padding: 4px 9px;
  font-size: 1.1rem;
}

.metro-button--send {
  min-width: 112px;
}

.split-layout {
  display: grid;
  gap: 108px;
  align-items: start;
}

.split-layout--login {
  grid-template-columns: minmax(360px, 500px) minmax(430px, 578px);
}

.split-layout--create {
  grid-template-columns: minmax(420px, 560px) minmax(420px, 560px);
  gap: 52px;
}

.login-card,
.create-preview-card,
.create-form,
.account-preview {
  padding: 16px 18px 24px;
}

.create-preview-card .inner-box {
  min-height: 322px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.field > span,
.field legend {
  font-size: clamp(1.3rem, 2.5vw, 2rem);
}

.metro-input {
  width: 100%;
  min-height: 52px;
  border: 2px solid var(--line);
  background: #000;
  color: var(--fg);
  padding: 8px 12px;
  font-size: 1.35rem;
  outline: 0;
}

.metro-input:focus {
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--line);
}

.metro-input--search {
  min-height: 38px;
  width: min(260px, 100%);
  font-size: 1.05rem;
  font-style: italic;
}

.login-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
  margin-top: 28px;
}

.inner-box {
  border: 2px solid var(--line);
  padding: 10px 14px;
}

.inner-box--small p {
  font-size: 1.04rem;
}

.align-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.hint {
  margin: 16px 0 0;
  color: var(--yellow);
  font-size: 1.05rem;
}

.local-profile {
  border: 2px solid var(--soft-line);
  padding: 10px;
  margin: 16px 0;
}

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

.local-profile .local-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-card {
  border: 2px solid var(--soft-line);
  padding: 12px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 128px;
}

.choice-card.selected {
  border-color: var(--line);
  background: #101010;
}

.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card strong {
  font-size: 1.35rem;
  font-weight: 400;
}

.choice-card span {
  color: var(--muted);
  line-height: 1.25;
}

.button-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.preview-id-card {
  border: 2px solid var(--line);
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  min-height: 128px;
  margin-bottom: 16px;
}

.preview-id-card strong,
.preview-id-card span {
  display: block;
}

.preview-id-card strong {
  font-size: 1.7rem;
  font-weight: 400;
}

.preview-id-card span {
  font-size: 1.05rem;
  color: var(--muted);
}

.avatar {
  width: 66px;
  height: 66px;
  object-fit: cover;
  border: 2px solid var(--line);
  background: #111;
}

.avatar--large {
  width: 88px;
  height: 88px;
}

.avatar-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.avatar-option {
  width: 74px;
  height: 74px;
  padding: 0;
  border: 2px solid var(--soft-line);
  background: #000;
  cursor: pointer;
}

.avatar-option.selected {
  border-color: var(--line);
}

.avatar-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-avatar {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  cursor: pointer;
}

.file-avatar input {
  display: none;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(410px, 540px);
  gap: 68px;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 34px;
  flex-wrap: wrap;
}

.section-title-row h2,
.home-column h2 {
  margin-bottom: 10px;
  text-align: left;
}

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

.contact-row {
  min-height: 86px;
  border: 2px solid var(--line);
  background: #030303;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
}

.contact-row:hover,
.contact-row:focus-visible {
  background: #101010;
  outline: 0;
}

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

.contact-row strong {
  font-size: 1.75rem;
  font-weight: 300;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-row .id-line {
  font-size: 1.05rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-status {
  text-align: right;
  font-size: 1.3rem;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact-status .online {
  color: var(--green);
}

.contact-status .offline {
  color: var(--fg);
}

.contact-status .arrow {
  font-size: 2.2rem;
  line-height: .8;
}

.link-row {
  display: flex;
  justify-content: space-between;
  margin: 20px 0 18px;
  gap: 20px;
  flex-wrap: wrap;
}

.text-button {
  background: transparent;
  color: var(--fg);
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 1.45rem;
  text-align: left;
}

.text-button:hover,
.text-button:focus-visible {
  text-decoration: underline;
  outline: 0;
}

.my-id-card {
  padding: 20px;
  margin-bottom: 26px;
}

.my-id-content {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.my-id-content strong,
.my-id-content span,
.my-id-content em {
  display: block;
  overflow-wrap: anywhere;
}

.my-id-content strong {
  font-size: 1.4rem;
  font-weight: 400;
}

.my-id-content span,
.my-id-content em {
  font-size: 1.15rem;
}

.my-id-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.status-select {
  border: 2px solid var(--line);
  background: #000;
  color: var(--fg);
  min-height: 32px;
  padding: 2px 8px;
}

.file-card {
  padding: 5px 10px 18px;
}

.file-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 1.3rem;
}

.stat-box {
  border: 2px solid var(--line);
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  margin-top: 12px;
  font-size: 1.25rem;
}

.chat-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.chat-header__identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.chat-header h1 {
  text-align: left;
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header span {
  color: var(--muted);
}

.connection-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  border: 2px solid var(--line);
  padding: 4px 9px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.pill--green {
  color: var(--green);
}

.message-list {
  height: min(560px, calc(100vh - 270px));
  min-height: 360px;
  border: 2px solid var(--line);
  background: #050505;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-bubble {
  width: min(720px, 88%);
  border: 2px solid #444;
  background: var(--bubble);
  box-shadow: inset 0 1px 0 var(--shadow);
  align-self: flex-start;
}

.message-bubble.own {
  align-self: flex-end;
  background: var(--bubble-own);
  border-color: var(--line);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #777;
  padding: 4px 8px;
  font-size: .92rem;
  font-weight: 600;
}

.message-text {
  padding: 8px;
  font-size: 1.04rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.chat-input {
  min-height: 48px;
}

.toast-area {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 36px));
}

.toast {
  border: 2px solid var(--line);
  background: #060606;
  padding: 12px 14px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .6);
  animation: toast-in .16s ease-out;
}

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

.toast span {
  color: var(--muted);
  margin-top: 4px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .78);
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-card {
  width: min(620px, 100%);
  border: 2px solid var(--line);
  background: #030303;
  padding: 20px;
}

.modal-card h2 {
  margin-bottom: 12px;
}

.modal-card p,
.modal-card li {
  font-size: 1.08rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.danger-button {
  border-color: var(--danger);
  color: var(--danger);
}

.export-options {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.export-options button {
  text-align: left;
}

.empty-state {
  border: 2px dashed var(--soft-line);
  padding: 18px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.shake {
  animation: shake .26s ease-in-out;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 980px) {
  .topbar {
    min-height: 108px;
    padding: 22px 24px 14px;
  }

  .brand__logo {
    width: 58px;
    height: 58px;
  }

  .split-layout,
  .home-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .gear {
    top: 76px;
    right: 22px;
    width: 52px;
    height: 52px;
    font-size: 3rem;
  }

  .settings-menu {
    top: 130px;
    right: 24px;
  }

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

  .connection-pills {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .stage {
    width: min(100vw - 24px, 1210px);
  }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand__name {
    font-size: 1.9rem;
  }

  .prealpha {
    font-size: 1rem;
  }

  h1 {
    margin-bottom: 24px;
  }

  .choice-row,
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .contact-row {
    grid-template-columns: 66px minmax(0, 1fr) 58px;
  }

  .contact-row strong {
    font-size: 1.35rem;
  }

  .my-id-content,
  .preview-id-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .wide-actions {
    gap: 16px;
  }
}

.contact-status .ausente {
  color: var(--yellow);
}

.contact-status .ocupado {
  color: var(--danger);
}

.contact-status .invisível {
  color: var(--muted);
}

.message-bubble.own {
  box-shadow: inset 0 -2px 0 #1684ff;
}

.message-bubble:not(.own) {
  box-shadow: inset 0 -2px 0 #777;
}

.toast.leaving {
  animation: toast-out .22s ease-in forwards;
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}
