:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #261d2e;
  background: #f1eaf0;
  color-scheme: light;
  --accent: #63335e;
  --muted: #675968;
  --line: #ece3eb;
  --avatar-size: 2.65rem;
  --button-radius: .7rem;
}
* { box-sizing: border-box; }
body { margin: 0; display: grid; min-height: 100dvh; place-items: center; }
.messenger {
  --header-top-padding: 1.15rem;
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  width: min(72rem, calc(100% - 4rem));
  height: min(49rem, calc(100dvh - 4rem));
  border: 1px solid #ddd7ed;
  border-radius: 1.4rem;
  overflow: hidden;
  background: white;
  box-shadow: 0 20px 55px #33245a18;
}
aside { display: flex; flex-direction: column; min-height: 0; padding: var(--header-top-padding) 1.45rem 1.45rem; border-right: 1px solid var(--line); }
.brand, .profile, .chat-header, .sidebar-heading { display: flex; align-items: center; gap: .75rem; }
.brand { font-size: 1.25rem; font-weight: 750; letter-spacing: -.035em; }
.brand, h1, h2, strong { font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.mark, .avatar { display: grid; place-items: center; width: var(--avatar-size); height: var(--avatar-size); flex: none; border-radius: .9rem; background: #e8ddfb; color: #563b93; font-weight: 750; }
.mark, .self { background: var(--accent); color: white; }
.profile-heading { display: flex; align-items: center; gap: .75rem; overflow-wrap: anywhere; }
.profile-logo { position: relative; overflow: hidden; }
.profile-logo img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  object-fit: contain;
  transform: translate(-51%, -50%);
}
#sync-status[data-connected="true"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sidebar-heading { justify-content: space-between; margin: 2rem 0 .75rem; }
h1, h2, p { margin: 0; }
h1 { font-size: 1.55rem; letter-spacing: -.035em; }
h2 { font-size: 1.1rem; }
.profile-heading strong, .chat-header h2 { display: block; font-size: calc(1rem - 1px); line-height: 1.25; }
#identity, #chat-status { font-size: calc(.8rem - 1px); line-height: 1.25; }
.sidebar-heading h1 { font-size: 1rem; }
small { display: block; color: var(--muted); font-size: .8rem; margin-top: .16rem; }
button, input { font: inherit; }
input { border-radius: .7rem; }
button { border: 0; border-radius: var(--button-radius); cursor: pointer; padding: .65rem .9rem; background: var(--accent); color: white; font-weight: 650; }
button:hover { filter: brightness(.94); }
button:focus-visible, input:focus-visible, #history:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { width: 100%; min-width: 0; border: 1px solid #ded9eb; background: #faf9fd; padding: .72rem .85rem; color: inherit; }
#search, #message { block-size: var(--avatar-size); padding-block: .5rem; background: white; font-size: calc(1rem - 1px); }
#search { flex-shrink: 0; }
nav { flex: 1; overflow: auto; margin: .8rem -.45rem; padding: .2rem .45rem; }
.thread { display: flex; text-align: left; gap: .7rem; align-items: center; width: 100%; color: inherit; background: transparent; padding: 3px; margin-bottom: .25rem; box-shadow: inset 0 0 0 1px transparent; }
.thread:hover, .thread[aria-current="true"] { background: #f1edff; }
.thread[aria-current="true"] { box-shadow: inset 0 0 0 1px #c9b4d6; }
.thread .avatar, #avatar { border-radius: 50%; }
.thread > span:last-child { min-width: 0; }
.thread small, .thread strong { display: block; font-family: inherit; font-weight: 400; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.thread strong { font-size: calc(1rem - 2px); }
.thread small { font-size: calc(.8rem - 2px); }
.thread .empty-preview { font-size: calc(.8rem - 3px); }
.profile { padding-top: 1rem; border-top: 1px solid var(--line); }
.chat { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; background: #fcfbff; font-size: calc(1rem - 1px); }
.chat small { font-size: calc(.8rem - 1px); }
.chat-header { padding: var(--header-top-padding) 1.5rem; background: white; border-bottom: 1px solid var(--line); }
#history { overflow: auto; padding: 1.5rem; }
.message { display: flex; flex-direction: column; align-items: flex-start; margin: .85rem 0; }
.message.mine { align-items: flex-end; }
.message p { max-width: min(88%, 33rem); overflow-wrap: anywhere; padding: .7rem .95rem; background: #eeebf7; border-radius: 1rem 1rem 1rem .25rem; white-space: pre-wrap; }
.message.mine p { background: var(--accent); color: white; border-radius: 1rem 1rem .25rem 1rem; }
.message small { margin: .3rem .15rem 0; }
.empty { color: var(--muted); text-align: center; padding: 1rem .3rem; }
#composer { display: flex; gap: .65rem; padding: 1rem 1.5rem; background: white; border-top: 1px solid var(--line); }
#notice { color: #8f263f; padding: 0 1.5rem .75rem; background: white; }
#notice:empty, #back { display: none; }
dialog { width: min(25rem, calc(100% - 2rem)); color: inherit; border: 1px solid var(--line); border-radius: 1rem; padding: 1.4rem; }
dialog::backdrop { background: #24194666; }
dialog label { display: block; margin: 1rem 0 .35rem; }
.actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
#cancel, #back { background: #eee9ff; color: #4227ac; }
@media (max-width: 650px) {
  .messenger { width: 100%; height: 100dvh; grid-template-columns: minmax(0, 1fr); border: 0; border-radius: 0; }
  aside { border: 0; }
  .chat, .messenger.chat-open aside { display: none; }
  .messenger.chat-open .chat { display: grid; }
  #back { display: inline-block; font-size: .875rem; }
  .chat-header, #composer, #history { padding: .9rem; }
}
[hidden] { display: none !important; }
.sign-in { width: min(27rem, calc(100% - 2rem)); background: white; padding: 2rem; border: 1px solid var(--line); border-radius: 1.4rem; box-shadow: 0 20px 55px #33245a18; }
#sign-in { width: min(21.6rem, calc(80% - 1.6rem)); }
.sign-in .brand { margin-bottom: 1.5rem; }
.sign-in-mark { width: var(--avatar-size); height: var(--avatar-size); flex: none; object-fit: contain; }
#open-sign-in-options {
  position: absolute;
  top: clamp(.65rem, 3vw, 1.75rem);
  right: clamp(.65rem, 3vw, 1.75rem);
  border: 1px solid #8b5ab0;
}
.sign-in label, #reset-password-dialog label { display: block; margin: .9rem 0 .35rem; }
.sign-in form button, #reset-password-dialog form button { width: 100%; margin-top: 1.1rem; }
.password-field { position: relative; }
.password-field input { padding-inline-end: 3rem; }
.sign-in form #toggle-password { position: absolute; inset-block: 0; inset-inline-end: .25rem; display: grid; place-items: center; width: 2.5rem; margin: 0; padding: 0; background: transparent; color: var(--accent); }
.password-eye { position: relative; display: grid; place-items: center; width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 75% 5%; transform: rotate(45deg); }
.password-eye::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
#toggle-password[aria-pressed="true"] .password-eye::after { content: ""; position: absolute; width: 22px; height: 2px; background: currentColor; box-shadow: 0 1px #faf9fd; }
.sign-in .mailbox-option { display: block; margin-top: 1.1rem; padding: .65rem .9rem; border-radius: var(--button-radius); color: var(--accent); background: #f4edf3; text-align: center; text-decoration: none; font-weight: 650; }
.sign-in .mailbox-option:hover { filter: brightness(.94); }
#password-reset-status { margin-top: .75rem; color: var(--muted); }
#password-reset-status:empty { display: none; }
#ios-push-help { color: var(--muted); margin-top: 1rem; font-size: .875rem; }
.mailbox-address { display: flex; align-items: center; gap: .5rem; }
.mailbox-address span { color: var(--muted); }
#mailbox-page p { margin-top: .65rem; }
#login-error, #create-error { color: #8f263f; margin-top: .6rem; }
#invitation { padding: 1rem 1.5rem; background: white; border-top: 1px solid var(--line); }
.profile > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-header h2 { overflow-wrap: anywhere; }
button:disabled { cursor: wait; opacity: .65; }
#legacy { padding: 1rem 1.5rem; background: white; border-top: 1px solid var(--line); }
#legacy button { margin-top: .6rem; }
.profile { flex-wrap: wrap; }
.profile > div { flex-basis: calc(100% - 4rem); }
#close-backup { background: #eee9ff; color: #4227ac; font-size: .875rem; }
#backup-status, #save-backup p { margin: .65rem 0; color: var(--muted); }
#backup-dialog form button { margin-top: .8rem; }
#generated-key { font-family: monospace; }
.older { display: block; min-block-size: var(--avatar-size); margin: 0 auto .8rem; font-weight: 400; }
.chat-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.chat-bell { position: relative; width: 12px; height: 12px; margin-bottom: 9px; border: 1px solid currentColor; border-radius: 7px 7px 3px 3px; }
.chat-bell::before, .chat-bell::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); background: currentColor; border-radius: 2px; }
.chat-bell::before { width: 15px; height: 1.5px; bottom: -1px; }
.chat-bell::after { width: 4px; height: 2px; bottom: -4px; }
#chat-alert-dot { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: #d3213e; }
.options-toggle, #new-chat, #chat-alerts, .older { color: #542c50; background: #f4edf3; }
.options-toggle, #new-chat, #chat-alerts { display: grid; place-items: center; flex: none; width: var(--avatar-size); height: var(--avatar-size); padding: 0; }
.options-toggle::before, #new-chat::before, #new-chat::after { content: ""; width: 16px; height: 2px; border-radius: 1px; background: currentColor; }
.options-toggle::before { box-shadow: 0 -5px currentColor, 0 5px currentColor; }
#new-chat::before, #new-chat::after { grid-area: 1 / 1; }
#new-chat::after { transform: rotate(90deg); }
#mobile-options { display: none; margin-left: auto; }
#chat-options, #sign-in-options, #reset-password-dialog { max-height: calc(100dvh - 2rem); box-shadow: 0 18px 54px #33245a25; }
#chat-options header, #sign-in-options header, #reset-password-dialog header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .7rem; }
.options-close { padding: .25rem .6rem; font-size: 1.25rem; color: #542c50; background: #f4edf3; }
.options-list { display: grid; gap: .2rem; }
.options-list > button, .options-list > a, .options-list > details, #chat-options .device-mode { padding: .65rem .75rem; text-align: left; color: #542c50; background: #f8f4f8; border-radius: var(--button-radius); font-size: .875rem; }
.options-list > button:hover, .options-list > a:hover { background: #eee5ee; }
.options-list > a { text-decoration: none; font-weight: 650; }
.options-list summary { cursor: pointer; font-weight: 650; }
.options-list details p { margin-top: .5rem; }
#chat-options #logout { margin-top: .35rem; color: #962b4e; }
#chat-alerts-dialog { max-height: calc(100dvh - 2rem); }
#chat-alert-list { padding: 0; list-style: none; }
#chat-alert-list li + li { margin-top: .9rem; }
#chat-alert-list p { margin-top: .35rem; }
#chat-alert-list button { margin-top: .5rem; }
#close-verification, #cancel-verification, #verification-mismatch {
  background: #eee9ff; color: #4227ac; font-size: .875rem;
}
#verification-dialog { width: min(37rem, calc(100% - 2rem)); }
#verification-device, #verification-status { margin: .8rem 0; color: var(--muted); overflow-wrap: anywhere; }
#peer-devices, #verification-code { padding: 0; list-style: none; }
#peer-devices li { display: flex; align-items: center; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
#peer-devices li div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#verification-code { display: grid; grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr)); gap: .5rem; }
#verification-code li { padding: .55rem .2rem; text-align: center; border-radius: .65rem; background: #f1edff; }
#verification-code strong { display: block; font-size: 1.5rem; }
.verification-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
@media (max-width: 650px) {
  .chat-header { flex-wrap: wrap; }
  #mobile-options { display: grid; }
}
#cross-signing-status { margin: .65rem 0; color: var(--muted); }
#cross-signing-status:empty { display: none; }
.device-mode { display: flex; align-items: center; gap: .55rem; width: 100%; font-size: .875rem; }
.device-mode input { flex: none; width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }
#device-mode-status { width: 100%; }
#device-mode-status:empty { display: none; }
#my-devices-dialog { width: min(37rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); }
#close-my-devices, #cancel-revoke { background: #eee9ff; color: #4227ac; font-size: .875rem; }
#my-devices-status, #revoke-target { margin: .75rem 0; color: var(--muted); }
#signed-in-devices { list-style: none; padding: 0; }
#signed-in-devices li { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
#signed-in-devices li div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#revoke-device button[type="submit"] { background: #a42649; }
#new-device-alert { flex-basis: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .6rem; border-radius: .7rem; background: #fff1dc; }
#new-device-alert small { color: #603d12; flex: 1; margin: 0; }
#mobile-device-alert { display: none; background: #774b1b; font-size: calc(.875rem - 1px); }
@media (max-width: 650px) {
  #mobile-device-alert { display: inline-block; }
}
#signed-in-devices .new-sign-in { color: #774b1b; font-weight: 650; }
#signed-in-devices .device-actions { flex: none; display: flex; flex-wrap: wrap; gap: .35rem; }
#signed-in-devices .recognize-device { background: #eee9ff; color: #4227ac; }
#history-dialog { width: min(37rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); }
#close-history { background: #eee9ff; color: #4227ac; font-size: .875rem; }
#history-status { margin: .75rem 0; color: var(--muted); }
#sign-in-records { list-style: none; padding: 0; }
#sign-in-records li { padding: .7rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#sign-in-records li:focus { outline: 2px solid #644ce5; outline-offset: 2px; border-radius: .35rem; }
#sign-in-records li button { margin-top: .45rem; font-size: .875rem; }
#sign-in-push { background: #eee9ff; color: #4227ac; font-size: .875rem; }
#sign-in-push-status { width: 100%; }
#sign-in-push-status:empty { display: none; }
.workspace-nav { display: grid; gap: .4rem; }
.workspace-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: .7rem 0; }
.icon-control {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  padding: .4rem;
  color: #63335e;
  background: #f8f2f7;
  border: 1px solid #eee2ed;
}
.icon-control:hover, .icon-control:focus-visible { background: #efe2ee; filter: none; z-index: 1; }
#logout { color: #8f284e; background: #faf0f2; border-color: #f1dce4; }
[data-icon]::before {
  content: "";
  width: 1.5rem;
  height: 1.5rem;
  background: currentColor;
  mask: url("griotalk-interface-icons.png") var(--icon-position) center / 1100% 100% no-repeat;
}
[data-icon="board"] { --icon-position: 0%; }
[data-icon="language"] { --icon-position: 10%; }
[data-icon="chat"] { --icon-position: 20%; }
[data-icon="tasks"] { --icon-position: 30%; }
[data-icon="groups"] { --icon-position: 40%; }
[data-icon="campaigns"] { --icon-position: 50%; }
[data-icon="devices"] { --icon-position: 70%; }
[data-icon="history"] { --icon-position: 80%; }
[data-icon="backup"] { --icon-position: 90%; }
[data-icon="logout"] { --icon-position: 100%; }
.icon-control::after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + .42rem);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 10rem;
  padding: .35rem .55rem;
  border-radius: .45rem;
  background: #352034;
  color: white;
  font-size: .75rem;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
  visibility: hidden;
}
.icon-control:hover::after, .icon-control:focus-visible::after { visibility: visible; }
.workspace-nav .icon-control:nth-child(3n + 1)::after {
  left: 0;
  transform: none;
}
.workspace-nav .icon-control:nth-child(3n)::after {
  right: 0;
  left: auto;
  transform: none;
}
aside { overflow: auto; }
#conversations { min-height: 5rem; }
.workspace-dialog { width: min(36rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); }
.workspace-dialog header { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.workspace-dialog h2 { font-size: 1.55rem; }
.workspace-dialog label > span { display: block; margin-bottom: .3rem; }
.workspace-dialog form > button { margin: .65rem .4rem 0 0; }
.workspace-dialog select, .workspace-dialog textarea { font: inherit; color: inherit; width: 100%; background: #fcf9fc; border: 1px solid #dcd0db; border-radius: .6rem; padding: .6rem; }
.workspace-dialog textarea { min-height: 6rem; resize: vertical; }
.workspace-dialog fieldset { border: 1px solid var(--line); border-radius: .65rem; margin: .8rem 0; padding: .5rem .75rem; }
.workspace-dialog ul { padding: 0; list-style: none; }
.workspace-dialog li, .workspace-dialog article { border-top: 1px solid var(--line); padding: .65rem 0; overflow-wrap: anywhere; }
.workspace-dialog li button, .workspace-dialog article button { margin: .4rem .35rem 0 0; }
.workspace-dialog article p { white-space: pre-wrap; }
.workspace-dialog li label, .workspace-dialog fieldset label { display: flex; align-items: baseline; gap: .45rem; margin: .25rem 0; }
.workspace-dialog input[type="checkbox"] { width: auto; accent-color: var(--accent); }
#workspace-status:not(:empty) { padding-top: .8rem; }
#composer { flex-wrap: wrap; }
#message { flex: 1; line-height: 1.3125rem; }
#attachment-name { width: 100%; overflow-wrap: anywhere; }
#composer [data-chat-icon] {
  display: grid;
  place-items: center;
  align-self: center;
  flex: none;
  inline-size: var(--avatar-size);
  block-size: var(--avatar-size);
  padding: 0;
}
.attachment-picker { position: relative; border-radius: var(--button-radius); color: #542c50; background: #f4edf3; }
[data-chat-icon]::before {
  content: "";
  display: block;
  inline-size: 1.3rem;
  block-size: 1.3rem;
  background: currentColor;
  mask: url("griotalk-chat-icons.png") var(--chat-icon-position) center / 300% 100% no-repeat;
}
[data-chat-icon="person"] { --chat-icon-position: 0%; }
[data-chat-icon="attach"] { --chat-icon-position: 50%; }
.attachment-picker::before { inline-size: calc(1.3rem + 5px); block-size: calc(1.3rem + 5px); }
[data-chat-icon="send"] { --chat-icon-position: 100%; }
.attachment-picker:focus-within { outline: 2px solid var(--accent); }
.attachment-picker input { position: absolute; inset: 0; height: 100%; opacity: 0; cursor: pointer; }

.workspace-nav .inbox-link { grid-column: 1 / -1; width: 100%; color: var(--accent); border-radius: var(--button-radius); font-weight: 650; text-decoration: none; }
