:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  color: #eef3f8;
  background: #0f1117;
  accent-color: #2aabee;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 70rem; margin: auto; padding: 1.25rem; }
.bar {
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #293343;
  padding: .75rem max(1.25rem, calc((100% - 67.5rem) / 2));
}
.brand, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.brand { color: inherit; text-decoration: none; font-size: 1.2rem; font-weight: 750; }
.brand img { border-radius: .5rem; }
.card { border: 1px solid #293343; background: #171c26; border-radius: .75rem; padding: 1.25rem; min-width: 0; }
.narrow { max-width: 27rem; margin: 2rem auto; }
.layout { display: grid; grid-template-columns: minmax(13rem, 18rem) 1fr; gap: .9rem; }
.sidebar { align-self: start; }
.thread { min-height: 30rem; display: flex; flex-direction: column; }
h1, h2 { margin: 0 0 1rem; font-size: 1.25rem; overflow-wrap: anywhere; }
.notice { min-height: 1.3rem; margin: 0 0 .75rem; color: #f3bb8e; }
.muted { font-size: .9rem; color: #afbed0; }
form, fieldset, label { display: grid; gap: .5rem; }
form { gap: .8rem; }
fieldset { margin: 0; padding: 0; border: 0; }
label { font-size: .9rem; }
input, textarea, select, button {
  font: inherit;
  color: inherit;
  border: 1px solid #415168;
  background: #111722;
  padding: .65rem .75rem;
  border-radius: .4rem;
  min-width: 0;
}
textarea { resize: vertical; }
button { cursor: pointer; width: fit-content; }
button:hover:not(:disabled) { border-color: #81cffa; }
button:disabled { cursor: wait; opacity: .6; }
.primary { background: #2aabee; border-color: #2aabee; color: #081521; font-weight: 700; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid #81cffa; outline-offset: 2px;
}
#auth-switch { margin-top: .9rem; }
.contacts, .messages { padding: 0; list-style: none; }
.contacts { display: grid; gap: .4rem; }
.contacts button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.contacts [aria-current="true"] { border-color: #81cffa; }
summary { cursor: pointer; }
.fingerprint { display: block; font-family: monospace; overflow-wrap: anywhere; color: #9bdcff; margin: .5rem 0; }
.messages {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  min-height: 8rem;
  max-height: min(60vh, 35rem);
  overflow-y: auto;
  flex: 1;
}
.message {
  align-self: flex-start;
  max-width: min(90%, 38rem);
  background: #263044;
  border-radius: .6rem;
  padding: .6rem .8rem;
  overflow-wrap: anywhere;
}
.message.sent { align-self: flex-end; background: #103751; }
.message p { margin: .25rem 0; white-space: pre-wrap; }
.message time { color: #bacadd; font-size: .75rem; }
.message button { display: block; margin: .25rem 0; max-width: 100%; overflow-wrap: anywhere; }
.compose { border-top: 1px solid #293343; padding-top: .9rem; }
@media (max-width: 39rem) {
  main { padding: .75rem; }
  .layout { grid-template-columns: 1fr; }
  .card { padding: 1rem; }
}

#profile { margin-bottom: 1rem; }
#profile-form { margin-block: .75rem; }

body {
  background: radial-gradient(ellipse at 15% 0%, #172d40 0, transparent 52%), #0e141d;
  min-height: 100vh;
}
.bar { background: #101a25; }
.card { border-radius: 1.1rem; background: #16202c; box-shadow: 0 10px 34px #06090f40; }
.narrow { margin: clamp(2rem, 9vh, 6rem) auto; padding: clamp(1.4rem, 4vw, 2.3rem); }
.auth-mark { border-radius: .9rem; margin-bottom: 1.15rem; }
.narrow h1 { font-size: 1.8rem; letter-spacing: -.035em; }
.intro, .muted, small { color: #b8cad8; line-height: 1.5; }
.intro { margin: -.4rem 0 1.45rem; }
.narrow .primary { width: 100%; margin-top: .5rem; }
.sidebar > details { border-bottom: 1px solid #334354; padding-bottom: .7rem; margin-bottom: .8rem; }
summary { font-weight: 600; padding: .35rem 0; }
details form, #enrollment, #recovery { margin: .85rem 0; }
#enrollment img { display: block; background: white; width: min(100%, 13rem); border-radius: .45rem; }
#backup-codes { padding: .75rem; background: #0d1721; line-height: 1.65; }
.primary { border-radius: .6rem; }
input:read-only { color: #a8b6c1; }
.notice:not(:empty) { padding: .7rem 1rem; border-left: 3px solid #68c1ec; background: #192a38; color: #d8ebf7; }

#settings-dialog {
  width: min(31rem, calc(100% - 2rem)); max-height: 85dvh; padding: 0;
  border: 1px solid #40536a; border-radius: 1.2rem; color: inherit;
  background: #16212e; box-shadow: 0 2rem 6rem #03070e88;
}
#settings-dialog::backdrop { background: #071019bd; backdrop-filter: blur(5px); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.4rem;
  background: #16212e; position: sticky; top: 0; border-bottom: 1px solid #384657; z-index: 1;
}
.dialog-head h2 { margin: 0; }
.dialog-head button { padding: .45rem .7rem; }
.settings-body { padding: 1.15rem; }
.settings-body > details { border: 1px solid #36485b; border-radius: .75rem; padding: .7rem 1rem; margin: 0 0 .6rem; }
.settings-body > details[open] { background: #1a2937; border-color: #47708a; }
.settings-body .notice:empty { display: none; }
.settings-body summary { color: #def1fe; }
.settings-body details[open] > summary { margin-bottom: .5rem; }
.bar #identity { font-size: .9rem; color: #bdd2e0; }
@media (max-width: 39rem) {
  .bar { gap: .35rem; }
  .bar .actions { gap: .35rem; }
  .bar button { padding: .5rem; }
  #settings-dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 1.15rem 1.15rem 0 0; }
}

.password-field { display: grid; gap: .5rem; min-width: 0; }
.password-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
.password-entry input { width: 100%; }
.password-entry button { font-size: .85rem; padding-inline: .7rem; }
label.remember-device { display: flex; align-items: center; gap: .6rem; }
.remember-device input { width: 1rem; height: 1rem; flex: none; }

.password-request { margin: 0 auto 1rem; max-width: 42rem; }
.password-request p { line-height: 1.5; }
#admin h3 { margin: 1.25rem 0 .65rem; font-size: 1rem; }
#admin-users { width: 100%; padding: .3rem; }
#admin-users option { padding: .45rem; }

.sidebar > details { margin: .6rem 0; }
.sidebar details form, #group-settings form { margin: .75rem 0; }
#group-settings { margin-bottom: 1rem; }
#group-roster { overflow-wrap: anywhere; }
.message strong { display: block; font-size: .85rem; color: #9bdcff; }

.thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.thread-head > div:first-child { min-width: 0; }
.thread-head h2 { margin: .35rem 0; }
#peer-status { margin: .15rem 0 .4rem; overflow-wrap: anywhere; }
#peer-status:empty { display: none; }
.icon-control {
  display: inline-grid; place-items: center; flex: none; width: 2.65rem; height: 2.65rem;
  padding: 0; border-radius: .75rem; color: #bccee0; background: #1c2b39; border: 1px solid #384c60;
}
.icon-control svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#timer-setting { position: relative; }
#timer-setting:hover, #timer-setting:focus-within { border-color: #81cffa; }
#timer-setting:focus-within { outline: 2px solid #81cffa; outline-offset: 2px; }
#timer { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.compose-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: .4rem; }
.compose-line textarea { width: 100%; min-height: 2.65rem; max-height: 9rem; line-height: 1.4; border-radius: .75rem; resize: vertical; }
#send { background: #2aabee; border-color: #2aabee; color: #081521; }
#send:hover { background: #5dbff2; }
.attachment { display: flex; align-items: center; gap: .45rem; justify-self: start; max-width: 100%; padding: .15rem .2rem .15rem .65rem; border-radius: .5rem; background: #223544; }
#attachment-name { min-width: 0; overflow-wrap: anywhere; font-size: .85rem; }
#remove-file { padding: .15rem .5rem; border: 0; background: transparent; }
#factor-state { color: #c4d6e4; font-size: .95rem; line-height: 1.5; }
#factor-submit { background: #235069; border-color: #396680; }

.group-message { padding-block: .38rem; }
.group-message-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .7rem; justify-content: space-between; }
.group-message-head time { white-space: nowrap; }
.group-message p { margin: .12rem 0 0; }
.archive-source { display: block; color: #b8cad8; }
