:root {
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #172d45;
  background: #f2f6fa;
  --accent: #1c6d96;
  --accent-hover: #155576;
  --subtle: #e6f0f8;
  --ink: #172d45;
  --muted: #52677d;
  --line: #dce5ee;
  --surface: #fff;
  --danger: #9e3a3a;
  --brand-blue: #174fb9;
  --brand-green: #007052;
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
ul { padding: 0; margin: 0; list-style: none; }
button, input, select, textarea { color: inherit; font: inherit; }
input, select, textarea { min-width: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid #267db5;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #edf4fa; }
.button:disabled { cursor: default; opacity: .5; }
.button-primary, .button-primary:disabled { color: #fff; background: var(--accent); border-color: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-quiet { color: var(--accent); background: transparent; border-color: transparent; }
.button-quiet:hover:not(:disabled) { background: var(--subtle); }

input, select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #627689; }

.sign-in {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse at 15% 8%, #e2edf7 0, #f2f6fa 60%);
}
.sign-in-card {
  display: grid;
  justify-items: start;
  gap: 15px;
  width: min(100%, 400px);
  padding: clamp(20px, 6vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 45px #1b3b5e10;
}
.sign-in-card h1 { font-size: 1.7rem; }
.sign-in-card p { color: var(--muted); line-height: 1.55; }
.sign-in-card form { gap: 8px; width: 100%; }
.sign-in-card form button { justify-self: start; }
#credentials-form input, #pairing-form input { font-size: 16px; }
.sign-in-logo {
  position: relative;
  display: grid;
  place-items: center;
  width: min(144px, 100%);
  aspect-ratio: 176 / 116;
}
.sign-in-mark { display: block; max-width: 100%; height: auto; }
.sign-in-brand-layer {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .sign-in[data-loading] .sign-in-mark { visibility: hidden; }
  .sign-in[data-loading] .sign-in-brand-layer { display: block; }
  .sign-in[data-loading] .sign-in-brand-plus {
    transform-origin: 55.966% 55.172%;
    animation: sign-in-plus-turn 1.2s linear infinite;
  }
}
@keyframes sign-in-plus-turn {
  from { transform: translateX(13.636%) rotate(0turn); }
  to { transform: translateX(13.636%) rotate(1turn); }
}

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-areas: "limit" "workspace" "notice";
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #f4f7fa;
}
.app, #new-dialog, #interportal-dialog, #members-dialog, #phone-dialog, #task-dialog, #message-search-dialog, #chat-shared-dialog, #forward-dialog {
  font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.employee-limit-warning {
  grid-area: limit;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #e8d29f;
  background: #fff6df;
  color: #68491a;
  line-height: 1.4;
}
.plus-icon, .search-icon, .bell-icon { position: relative; display: inline-block; flex: 0 0 auto; }
.plus-icon { width: 12px; height: 12px; }
.plus-icon::before, .plus-icon::after {
  content: "";
  position: absolute;
  inset: 5px 0;
  border-radius: 1px;
  background: currentColor;
}
.plus-icon::after { transform: rotate(90deg); }
.search-icon { width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 50%; }
.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 1.5px;
  right: -4px;
  bottom: -1px;
  background: currentColor;
  transform: rotate(45deg);
}
.bell-icon { width: 12px; height: 11px; border: 1.5px solid currentColor; border-radius: 8px 8px 3px 3px; }
.bell-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: -4px;
  width: 3px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: currentColor;
}
.support-logo {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
}
.interportal-icon {
  position: relative;
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex: none;
}
.interportal-icon::before, .interportal-icon::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 4px 4px 4px 1px;
}
.interportal-icon::before { inset: 4px auto auto 2px; }
.interportal-icon::after { inset: auto 2px 4px auto; background: var(--surface); }

.workspace {
  --sidebar-width: max(257px, 32%);
  --sidebar-rail-width: 68px;
  grid-area: workspace;
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 0;
}
.sidebar {
  container: chat-sidebar / inline-size;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  background: #fff;
  border-right: 1px solid var(--line);
}
.sidebar-controls { padding: 18px 16px 4px; }
.sidebar-heading, .chat-filter { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-heading { margin-bottom: 14px; }
.sidebar-heading h1 { font-size: 1.32rem; line-height: 1.2; }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-icon { width: 38px; padding: 0; }
.sidebar-toggle { display: none; }
.sidebar-toggle-icon {
  width: 14px;
  height: 14px;
  border: solid currentColor;
  border-width: 0 0 0 2px;
  position: relative;
}
.sidebar-toggle-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}
.sidebar-toggle[aria-pressed="true"] .sidebar-toggle-icon::after {
  left: 3px;
  transform: rotate(225deg);
}
.search-box { position: relative; color: var(--muted); }
.search-box .search-icon { position: absolute; left: 12px; top: 12px; pointer-events: none; }
.search-box input { display: block; width: 100%; padding-left: 34px; background: #f4f7fb; }
.chat-filter { gap: 4px; margin-top: 7px; }
.chat-filter .button { flex: 1 1 auto; min-height: 35px; padding: 5px 6px; font-size: .82rem; }
.chat-filter .button[aria-pressed="true"] { background: var(--subtle); color: var(--accent); }
.sidebar-history { overflow: auto; }
.sidebar-support {
  display: grid;
  padding: 4px 8px;
  border-top: 1px solid var(--line);
}
.sidebar-support .button { justify-content: flex-start; padding-inline: 6px; }
.sidebar-support .button[aria-current="true"] { background: var(--subtle); color: var(--accent); }
.sidebar-footer, .sidebar-account { display: flex; align-items: center; gap: 6px; }
.sidebar-footer { justify-content: space-between; padding: 4px 8px max(4px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sidebar-account { min-width: 0; }
.sidebar-footer .button { padding-inline: 6px; }
.user-name { overflow: hidden; max-width: 14ch; text-overflow: ellipsis; white-space: nowrap; }
.chat-list { padding: 0 8px 10px; }
.chat-section + .chat-section { margin-top: 9px; }
.chat-section-title { margin: 5px 8px 3px; color: var(--muted); font-size: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.chat-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.chat-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 64px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.chat-entry:hover { background: #f4f7fb; }
.chat-entry[aria-current="true"] { border-color: #cadeee; background: #eaf3fa; }
.chat-pin { width: 34px; min-height: 38px; padding: 0; color: var(--muted); }
.chat-pin[aria-pressed="true"] { color: var(--accent); }
.chat-pin[aria-disabled="true"] { opacity: .55; cursor: progress; }
.chat-pin-icon {
  width: 11px;
  height: 13px;
  background: currentColor;
  clip-path: polygon(20% 0, 80% 0, 80% 16%, 70% 16%, 70% 44%, 96% 65%, 96% 74%, 57% 74%, 50% 100%, 43% 74%, 4% 74%, 4% 65%, 30% 44%, 30% 16%, 20% 16%);
  transform: rotate(35deg);
}
.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: #dfeef8;
  color: #235775;
  font-size: .88rem;
  font-weight: 750;
  letter-spacing: -.025em;
}
.avatar[data-tone="1"] { background: #edebfc; color: #5c4a9a; }
.avatar[data-tone="2"] { background: #e0edf7; color: #355a7b; }
.avatar[data-tone="3"] { background: #f6e9da; color: #794f29; }
.avatar[data-tone="4"] { background: #f5e4ec; color: #8d4666; }
.avatar-small { width: 30px; height: 30px; border-radius: 9px; font-size: .79rem; }
#chat-avatar, .chat-entry .avatar, .picker-row .avatar-small { position: relative; overflow: hidden; }
.chat-avatar-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: inherit;
}
.avatar-online::after {
  content: '';
  position: absolute;
  inset-inline-end: 2px;
  inset-block-end: 2px;
  z-index: 1;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #00934e;
}
.chat-entry-copy, .chat-entry-meta { display: grid; gap: 3px; min-width: 0; }
.chat-entry-copy > *, .chat-entry-meta > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-entry-title { font-weight: 700; }
.chat-entry-position { color: var(--muted); font-size: .82rem; }
.chat-entry-preview { color: var(--muted); font-size: .9rem; }
.chat-entry-meta { justify-items: end; color: var(--muted); font-size: .78rem; text-align: right; }
.unread {
  min-width: 20px;
  line-height: 20px;
  padding: 0 5px;
  color: #fff;
  background: var(--brand-blue);
  border-radius: 99px;
  text-align: center;
  font-weight: 700;
}
.support-unread {
  flex: none;
  margin-inline-start: auto;
  font-size: .78rem;
  animation: support-unread-color 2s ease-in-out infinite alternate;
}
@keyframes support-unread-color {
  from { background-color: var(--brand-blue); }
  to { background-color: var(--brand-green); }
}
@media (prefers-reduced-motion: reduce) {
  .support-unread { animation: none; }
}
.list-empty, .sidebar-error { padding: 12px 16px; color: var(--muted); line-height: 1.45; }

@media (width > 640px) {
  .sidebar-toggle { display: inline-flex; }
  .workspace[data-sidebar-collapsed] { grid-template-columns: var(--sidebar-rail-width) minmax(0, 1fr); }
  .workspace[data-sidebar-collapsed] .sidebar {
    position: absolute;
    z-index: 2;
    inset: 0 auto 0 0;
    width: var(--sidebar-rail-width);
  }
  .workspace[data-sidebar-collapsed] .conversation { grid-column: 2; }
  .workspace[data-sidebar-collapsed] .sidebar[data-sidebar-preview],
  .workspace[data-sidebar-collapsed] .sidebar:has(:focus-visible:not(.sidebar-toggle)),
  .workspace[data-sidebar-collapsed] .sidebar:has(.search-box :focus, .chat-filter :focus, .sidebar-account :focus) {
    width: var(--sidebar-width);
    box-shadow: 10px 0 22px #1b3b5e1a;
  }
  .workspace[data-sidebar-collapsed] .sidebar-controls {
    display: grid;
    grid-template-columns: 59px minmax(0, 1fr);
    grid-template-rows: repeat(2, 38px) auto;
    gap: 6px;
    padding: 8px 10px 6px 4px;
  }
  .workspace[data-sidebar-collapsed] .sidebar-heading { display: contents; }
  .workspace[data-sidebar-collapsed] .sidebar-heading h1 { grid-area: 1 / 2; align-self: center; }
  .workspace[data-sidebar-collapsed] .sidebar-actions {
    grid-area: 1 / 1 / span 2;
    flex-direction: column;
    align-items: center;
  }
  .workspace[data-sidebar-collapsed] .chat-filter { grid-area: 3 / 1 / auto / -1; margin: 0; }
  .workspace[data-sidebar-collapsed] .search-box { grid-area: 2 / 2 / auto / -1; align-self: center; }
  .workspace[data-sidebar-collapsed] .chat-list { padding-inline: 5px; }
  .workspace[data-sidebar-collapsed] .chat-section-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace[data-sidebar-collapsed] .chat-entry { height: 64px; padding-block: 4px; }
}

@container chat-sidebar (max-width: 90px) {
  .workspace[data-sidebar-collapsed] .sidebar-controls { grid-template-columns: 59px; grid-template-rows: repeat(2, 38px); gap: 6px 0; padding-right: 4px; }
  .sidebar-heading h1, .search-box, .chat-filter, .sidebar-account,
  .sidebar-notification-label, .sidebar-support-label, .chat-pin, .chat-entry-meta > :not(.unread) { display: none; }
  .chat-section-title { opacity: 0; }
  .chat-entry-copy, .list-empty, .sidebar-error {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .sidebar-footer { justify-content: center; }
  .sidebar-support { justify-content: center; }
  .sidebar-support .button { position: relative; justify-content: center; }
  .support-unread {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: -8px;
    border: 1px solid var(--surface);
  }
  .sidebar-footer .button, .sidebar-support .button { width: 38px; }
  .chat-entry {
    position: relative;
    grid-template-columns: 1fr;
    justify-items: center;
    padding-inline: 4px;
  }
  .chat-entry-meta { position: absolute; top: 2px; right: 2px; }
  .chat-entry-meta .unread { border: 1px solid var(--surface); }
}

.conversation, .active-chat { height: 100%; min-height: 0; overflow: hidden; }
.empty-chat {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 100%;
  padding: 16px;
  text-align: center;
  background: radial-gradient(ellipse at 55% 43%, #e5eef8 0, transparent 68%);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 69px;
  height: 69px;
  margin-bottom: 6px;
  border: 1px solid #cfdfed;
  border-radius: 19px;
  background: #e7f0fa;
}
.empty-chat h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); }
.empty-chat p { color: var(--muted); }
.active-chat { display: flex; flex-direction: column; }
.conversation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 65px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.back-button { display: none; }
.support-back { display: inline-flex; min-width: 38px; min-height: 38px; padding: 0 7px; font-size: 1.8rem; font-weight: 400; }
.support-avatar { background: var(--surface); border: 1px solid var(--line); }
.conversation-caption { flex: 1 1 auto; min-width: 0; }
.conversation-caption h2, .conversation-caption p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-caption h2 { font-size: 1.14rem; line-height: 1.2; }
#support-title { white-space: normal; }
.conversation-caption p { margin-top: 4px; color: var(--muted); font-size: .83rem; }
.conversation-caption .chat-presence { margin-top: 1px; font-size: .8rem; line-height: 1.2; }
.chat-presence[data-online] { color: var(--brand-green); font-weight: 650; }
.chat-presence:not([hidden]) + #chat-summary:not(.chat-profile-summary) { display: none; }
.group-notifications, .conversation-search, .conversation-shared { width: 38px; flex: none; padding: 0; }
.group-notifications[aria-pressed="true"] { background: var(--subtle); border-color: #b8d5e8; }
.bell-icon {
  position: relative;
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 8px 8px 2px 2px;
}
.bell-icon::before {
  content: "";
  position: absolute;
  inset: auto 35% -4px;
  border-bottom: 2px solid currentColor;
  border-radius: 2px;
}
.group-notifications[aria-pressed="true"] .bell-icon::after {
  content: "";
  position: absolute;
  top: 5px;
  left: -4px;
  width: 19px;
  border-top: 1.5px solid currentColor;
  box-shadow: 0 -1px var(--subtle);
  transform: rotate(-45deg);
}
.conversation-caption .chat-profile-summary { display: flex; gap: 4px; margin-top: 3px; }
.chat-profile-chip {
  min-width: 0;
  overflow: hidden;
  padding: 0 6px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 650;
  line-height: 16px;
  text-overflow: ellipsis;
}
.chat-profile-chip-department { background: #dceefb; color: var(--accent-hover); }
.chat-profile-chip-position { background: #ddf4e7; color: var(--brand-green); }
.pinned-message {
  justify-content: start;
  min-width: 0;
  min-height: 42px;
  padding: 5px 16px;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--accent);
  text-align: start;
}
.pinned-message:focus-visible { outline-offset: -2px; }
.pinned-message .chat-pin-icon { flex: none; }
.pinned-message-caption { display: grid; gap: 2px; min-width: 0; }
.pinned-message-title { font-size: .78rem; }
.pinned-message-preview {
  overflow: hidden;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px clamp(12px, 3.2vw, 28px);
  background-image: radial-gradient(#dbe7f2 1px, transparent 1px);
  background-size: 19px 19px;
}
.messages { display: grid; gap: 9px; }
.older-messages { display: flex; margin: 0 auto 8px; }
.newer-messages { display: flex; margin: 8px auto 0; }
.latest-messages { align-self: center; margin: 4px 0; background: var(--surface); }
.history-status { margin: 0 auto 10px; color: var(--muted); text-align: center; line-height: 1.4; }
.message-date {
  justify-self: center;
  margin: 6px auto;
  padding: 4px 9px;
  background: #e6eef6;
  color: #4f667e;
  border-radius: 99px;
  font-size: .76rem;
}
.message-row {
  display: flex;
  align-items: end;
  gap: 5px;
  justify-self: start;
  max-width: min(86%, 650px);
}
.message-row-out { justify-self: end; }
.message {
  min-width: 90px;
  max-width: 600px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid #e0e8f0;
  border-radius: 4px 11px 11px 11px;
}
.message-out { background: #e2f0fb; border-color: #cfe4f5; border-radius: 11px 4px 11px 11px; }
.message-row:focus > .message { background: #fff6d5; outline: 2px solid #ce9c30; outline-offset: 1px; }
.message-sender { margin-bottom: 4px; color: var(--accent); font-size: .83rem; font-weight: 700; overflow-wrap: anywhere; }
.message-forwarded { margin-bottom: 3px; color: var(--muted); font-size: .8rem; }
.message-text { font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-mention { color: var(--accent); font-weight: 700; }
.message-mention-self { padding-inline: 2px; border-radius: 3px; background: #d9ecfc; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 3px 4px; margin-top: 3px; }
.message-time { margin-left: 4px; color: #4c667e; font-size: .73rem; }
.message-stamp { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.message-receipt { position: relative; display: inline-block; width: 15px; height: 12px; color: #4c667e; }
.message-receipt::before, .message-receipt::after {
  position: absolute;
  top: 0;
  left: 2px;
  width: 5px;
  height: 9px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.message-receipt::before, .message-receipt[data-receipt="delivered"]::after,
.message-receipt[data-receipt="read"]::after { content: ''; }
.message-receipt::after { left: 7px; }
.message-receipt[data-receipt="read"] { color: #008549; }
.message-receipt[data-receipt="read"]::before, .message-receipt[data-receipt="read"]::after {
  border-width: 0 2px 2px 0;
}
.message-action { min-height: 26px; padding: 2px 5px; font-size: .76rem; }
.message-options-button { width: 30px; min-height: 28px; padding: 0; }
.message-options-button[aria-expanded="true"] { background: var(--subtle); }
.message-options-button::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -5px 0 currentColor, 5px 0 currentColor;
}
.message-options-button[data-copied]::before {
  width: 11px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: rotate(-45deg);
}
.message-reaction {
  flex: none;
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #795469;
  font-size: 1.24rem;
  touch-action: pan-y;
  user-select: none;
  -webkit-touch-callout: none;
}
.message-reaction:is(:hover, [aria-pressed="true"]) { background: transparent; color: #a44365; }
.message-reaction[aria-disabled="true"] { cursor: wait; opacity: .55; }
.message-reaction-counts { display: flex; flex-wrap: wrap; gap: 3px; margin-inline-end: auto; }
.message-reaction-counts:empty { display: none; }
.message-reaction-count {
  padding: 2px 5px;
  border-radius: 10px;
  background: #2469b010;
  color: var(--ink);
  font-size: .78rem;
  white-space: nowrap;
}
.reaction-picker, .message-options {
  position: fixed;
  z-index: 3;
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 6px 20px #1b3b5e26;
}
.reaction-picker { display: flex; flex-wrap: wrap; gap: 2px; }
.reaction-picker .button { width: 38px; min-height: 38px; padding: 0; font-size: 1.25rem; }
.reaction-picker .button[aria-pressed="true"] { background: var(--subtle); }
.message-options {
  min-width: 164px;
  max-height: calc(100dvh - 16px);
  overflow: auto;
  overscroll-behavior: contain;
}
.message-options-actions { display: grid; }
.message-options .button {
  justify-content: start;
  min-width: 0;
  padding-inline: 10px;
  color: var(--ink);
  text-align: start;
  white-space: normal;
}
.message-options .button:focus-visible { background: var(--subtle); outline-offset: -2px; }
.message-options .button[aria-disabled="true"] { opacity: .5; cursor: wait; }
.message-readers {
  width: min(254px, calc(100vw - 26px));
  margin-top: 4px;
  padding: 6px 5px 4px;
  border-top: 1px solid var(--line);
  font-size: .82rem;
  color: var(--muted);
}
.message-readers-title { margin: 0 5px 4px; font-weight: 650; }
#message-readers-status { margin: 0 5px; }
.message-readers-list {
  max-height: min(112px, 23dvh);
  overflow: auto;
  overscroll-behavior: contain;
}
.message-readers-list:focus-visible { outline-offset: -2px; }
.message-readers-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 4px 5px;
}
.message-reader-name { color: var(--ink); overflow-wrap: anywhere; }
.message-reader-time { font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.message-quote {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0 0 6px;
  padding: 5px 8px;
  border-left: 3px solid #5b9bca;
  border-radius: 0 6px 6px 0;
  background: #2469b00c;
  color: #405c78;
  font-size: .84rem;
}
.quote-author { color: var(--accent); font-weight: 700; }
.quote-author, .quote-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 5px 0; }
.attachment-preview {
  display: grid;
  grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
  width: min(300px, 60vw);
  max-width: 100%;
  aspect-ratio: 16 / 11;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle);
  text-align: start;
  cursor: zoom-in;
}
.attachment-preview:hover { border-color: var(--accent); }
.attachment-preview-image {
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.attachment-preview-name {
  grid-row: 2;
  overflow: hidden;
  padding: 4px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  gap: 2px 8px;
  width: 100%;
  min-height: 33px;
  padding: 5px 7px;
  text-align: left;
}
.attachment-name { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--muted); font-size: .76rem; font-weight: 500; white-space: nowrap; }
.composer {
  --composer-field-height: 44px;
  display: grid;
  gap: 6px;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.composer-input { display: flex; align-items: end; gap: 7px; }
.composer-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.composer-field:focus-within { border-color: #267db5; }
.mention-list {
  position: absolute;
  inset: auto auto calc(100% + 6px) 0;
  z-index: 3;
  width: min(300px, 100%);
  max-height: min(210px, 33dvh);
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 5px 18px #172d4526;
}
.mention-option {
  padding: 9px 10px;
  border-radius: 6px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.mention-option[aria-selected="true"], .mention-option:hover { background: var(--subtle); }
.mention-option-department { display: block; color: var(--muted); font-size: 12px; }
.composer textarea {
  width: 100%;
  min-height: calc(var(--composer-field-height) - 2px);
  max-height: calc(var(--composer-field-height) * 1.3 - 2px);
  padding: 10px 8px 1px 11px;
  border: 0;
  background: transparent;
  font-size: 15px;
  line-height: 22px;
  resize: none;
  field-sizing: content;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #8ca6bd transparent;
}
.composer textarea:focus { outline: 0; }
.composer-input .button-send { min-height: var(--composer-field-height); }
.support-send-status { color: var(--muted); }
.support-topics-title { color: var(--muted); font-size: .86rem; font-weight: 650; }
.support-topics { display: flex; flex-wrap: wrap; gap: 5px; }
.support-topics .button {
  min-height: 32px;
  padding: 4px 9px;
  border-color: var(--line);
  border-radius: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.attach-button { width: 34px; min-height: 34px; margin: 0 3px 4px 0; padding: 0; }
.paperclip-icon { width: 9px; height: 17px; border: 2px solid currentColor; border-radius: 5px; transform: rotate(37deg); }
.composer-reply { display: flex; align-items: center; gap: 6px; }
.composer-quote { min-width: 0; flex: 1; }
.composer-reply .message-quote { margin: 0; }
.composer-files { display: flex; flex-wrap: wrap; gap: 4px; max-height: min(118px, 20dvh); overflow: auto; }
.composer-file {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  padding: 2px 2px 2px 7px;
  background: #edf4fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .86rem;
}
.composer-file-preview {
  width: 52px;
  height: 38px;
  flex: none;
  object-fit: contain;
  background: var(--surface);
  border-radius: 4px;
}
.composer-file .close-button { width: 28px; min-height: 28px; font-size: 1.2rem; }
.hidden-notice { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); text-align: center; }
.chat-write-blocked :is([data-message-action="reply"], [data-message-action="task"]) { display: none; }
.error { color: var(--danger); line-height: 1.4; overflow-wrap: anywhere; }
.chat-error { padding: 6px 14px; background: #fff5f5; }
.notification-open-status { grid-area: notice; margin: 0; }
.task-status, .forward-status { padding: 7px 14px; background: var(--subtle); color: var(--accent); }

dialog {
  width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 56px #17365755;
}
dialog::backdrop { background: #172d4566; }
#message-search-dialog { width: min(520px, calc(100% - 24px)); }
#message-search-dialog[open] { display: flex; flex-direction: column; }
#message-search-status { margin-block: 10px 0; }
#message-search-results { overflow: auto; min-height: 0; padding: 0 3px; list-style: none; }
#message-search-results:not(:empty) { margin-block: 8px 0; }
.message-search-result {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 9px 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
}
.message-search-result:hover { background: var(--subtle); }
.message-search-result:focus-visible { outline-offset: -2px; }
.message-search-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 8px; }
.message-search-date { color: var(--muted); font-size: .8rem; }
.message-search-excerpt { font-size: .92rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-search-excerpt mark { background: #fff0b2; color: inherit; }
#message-search-more { align-self: center; margin-top: 8px; }
#chat-shared-dialog { width: min(590px, calc(100% - 24px)); }
#chat-shared-dialog[open] { display: flex; flex-direction: column; }
#chat-shared-items { overflow: auto; min-height: 0; padding-inline: 3px; list-style: none; }
#chat-shared-items:not(:empty) { margin-block: 4px 0; }
.shared-item { display: grid; gap: 4px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.shared-item-details, .shared-item-actions { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; }
.shared-item-name { flex: 1 0 100%; font-weight: 650; overflow-wrap: anywhere; }
.shared-item-name:any-link { color: var(--accent); }
.shared-item-actions { gap: 8px; }
.shared-item-actions .button { min-height: 36px; padding: 4px 8px; }
#chat-shared-more { align-self: center; margin-top: 8px; }
#image-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #111821;
  color: #f1f6fd;
  box-shadow: none;
}
#image-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.image-viewer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
  border-bottom: 1px solid #344351;
  background: #192431;
}
.image-viewer-header h2 {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-viewer-header .button { min-height: 44px; border-color: #405368; background: #263545; color: inherit; }
.image-viewer-header .button:hover:not(:disabled) { background: #35485b; }
.image-viewer-header .button:focus-visible { outline-color: #87c8f0; }
.image-viewer-header .close-button { width: 44px; }
.image-viewer-stage {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
#image-viewer-content {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
#image-viewer-status { padding: 8px; text-align: center; overflow-wrap: anywhere; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dialog-header h2 { font-size: 1.27rem; letter-spacing: -.02em; }
.close-button { width: 32px; min-height: 32px; padding: 0; font-size: 1.5rem; line-height: 1; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin-bottom: 12px; background: #edf4fa; border-radius: 10px; }
#new-chat-kinds[data-interportal] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#new-chat-kinds button { overflow-wrap: anywhere; }
.segmented button { padding: 7px; color: var(--muted); font-weight: 650; background: transparent; border: 0; border-radius: 7px; cursor: pointer; }
.segmented button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px #1b3b5e22; }
dialog form, .sign-in-card form, .form-field { display: grid; }
dialog form, .form-field { gap: 8px; }
dialog form > .button { justify-self: end; }
fieldset { display: grid; gap: 5px; min-width: 0; padding: 0; margin: 0; border: 0; }
legend, .form-field { margin-bottom: 5px; font-weight: 650; }
.picker-list { display: grid; gap: 3px; max-height: min(33dvh, 200px); overflow: auto; padding: 3px; }
.picker-department + .picker-department { margin-top: 5px; }
.picker-department-title { margin: 0 0 2px; padding: 4px 8px; border-radius: 5px; background: #f4f7fb; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.picker-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 5px; border-radius: 8px; }
label.picker-row:hover { background: #edf4fa; cursor: pointer; }
.picker-row input { margin: 0 0 0 3px; accent-color: var(--accent); }
.picker-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.picker-details { display: block; padding-top: 2px; color: var(--muted); font-size: .85rem; }
.remove-button { color: var(--danger); min-height: 30px; padding: 5px 8px; }
#group-details-form { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
#group-details-fields { gap: 8px; }
.group-photo-row, .group-photo-actions { display: flex; align-items: center; gap: 8px; }
.group-photo-row { margin-bottom: 4px; }
.group-photo-actions { flex-wrap: wrap; }
#group-photo-preview { position: relative; overflow: hidden; width: 50px; height: 50px; border-radius: 12px; }
#group-members-heading { margin: 0 0 5px; font-size: .98rem; }
.group-member-role { color: var(--accent); font-weight: 650; }
#group-archive-section { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
#group-archive-section .button { white-space: nowrap; }
.group-settings-icon { display: none; font-size: 1.25rem; line-height: 1; }
#add-members-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.field-note, #phone-instructions, .phone-pairing p { color: var(--muted); line-height: 1.45; }
#interportal-dialog { width: min(490px, calc(100% - 24px)); }
#interportal-overview, .interportal-section, .interportal-invitation { display: grid; gap: 7px; }
#interportal-overview { gap: 15px; }
.interportal-section h3 { font-size: .98rem; }
#interportal-code-section { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f4f8fc; }
#interportal-code-section .phone-code { margin-top: 2px; text-align: left; }
#interportal-code { font: 700 1rem ui-monospace, monospace; user-select: all; overflow-wrap: anywhere; }
#interportal-settings summary { cursor: pointer; color: var(--accent); font-weight: 650; }
#interportal-settings-form { margin-top: 8px; }
.interportal-rotate { display: flex; align-items: center; gap: 7px; }
.interportal-rotate input { accent-color: var(--accent); }
.interportal-invitations-list, .interportal-portals-list { display: grid; gap: 5px; }
.interportal-invitation { padding: 9px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.interportal-invitation-title, .interportal-accept-title { font-weight: 650; overflow-wrap: anywhere; }
.interportal-actions { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
#start-interportal-chat { justify-self: end; }
#interportal-error, #invite-portal-status { margin-block-start: 8px; }
#members-portals, #invite-portal-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.interportal-portals-list { justify-items: start; }
.interportal-portals-list li { padding: 4px 7px; border-radius: 6px; background: var(--subtle); color: var(--accent); overflow-wrap: anywhere; }
.task-source { margin-bottom: 12px; padding: 10px 12px; border-radius: 8px; background: #edf4fa; }
.task-source-label { margin-bottom: 4px; color: var(--muted); font-size: .84rem; font-weight: 650; }
.task-message-preview { max-height: 110px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.45; }
.task-fields { gap: 6px; }
.task-fields .form-field { gap: 5px; }
.task-details { display: grid; grid-template-columns: minmax(185px, 1.2fr) minmax(0, 1fr); gap: 10px; }
.task-details .form-field { align-content: start; }
#task-timezone { font-size: .8rem; font-weight: 400; }
.task-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 6px; }
#phone-dialog p + p, .phone-pairing, .phone-actions { margin-top: 10px; }
.phone-pairing { padding: 12px; background: #f4f8fc; border: 1px solid var(--line); border-radius: 10px; }
.phone-code { width: 100%; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--accent); }
#phone-code { font: 700 1.2rem ui-monospace, monospace; user-select: all; overflow-wrap: anywhere; }
.copy-icon { position: relative; flex: none; width: 16px; height: 18px; }
.copy-icon::before, .copy-icon::after { position: absolute; content: ''; width: 10px; height: 12px; border: 1.5px solid currentColor; border-radius: 2px; }
.copy-icon::before { top: 1px; left: 1px; }
.copy-icon::after { bottom: 1px; right: 0; background: var(--surface); }
.phone-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#phone-dialog [aria-pressed="true"] { background: var(--subtle); color: var(--accent); }
#phone-dialog .field-note:not([hidden]) { margin-top: 7px; }
#phone-status, #install-sign-in-help, #install-notification-help { overflow-wrap: anywhere; }
#browser-extension-settings { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
#browser-extension-title { margin: 0; font-size: 1rem; }
.settings-page {
  width: min(720px, calc(100% - 24px));
  margin: 12px auto;
  padding: clamp(14px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.settings-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.settings-header h1 { font-size: 1.4rem; letter-spacing: -.02em; }
.settings-page form { display: grid; gap: 16px; }
.settings-page form > .button { justify-self: start; }
.settings-fields { gap: 12px; }
.settings-section { display: grid; gap: 6px; }
.settings-section + .settings-section { border-top: 1px solid var(--line); padding-top: 12px; }
.settings-picker { margin-top: 6px; }
.settings-picker .picker-list { max-height: min(24dvh, 164px); }
.settings-page form:not([hidden]) ~ p, #reload-settings { margin-top: 10px; }

@media (max-width: 640px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; }
  .conversation { display: none; }
  .app[data-open-chat] .sidebar { display: none; }
  .app[data-open-chat] .conversation { display: block; }
  .conversation-header { min-height: 54px; padding: 5px 8px; gap: 7px; }
  .back-button { display: inline-flex; min-height: 38px; padding: 0 7px; font-size: 1.8rem; font-weight: 400; }
  .conversation-header .avatar { width: 34px; height: 34px; border-radius: 10px; }
  .conversation-search, .conversation-shared { width: 42px; min-height: 42px; }
  .group-settings-button { width: 42px; min-height: 42px; padding: 0; }
  .group-settings-button .group-settings-icon { display: inline-block; }
  .group-settings-button #show-members-label { display: none; }
  .chat-pin { width: 42px; min-height: 42px; }
  .chat-filter .button, .shared-item-actions .button { min-height: 42px; }
  .message-scroll { padding: 8px; }
  .messages { gap: 5px; }
  .message-date { margin-block: 3px; }
  .message-row { max-width: 100%; gap: 2px; }
  .message { padding: 5px 7px; }
  .message-sender { margin-bottom: 2px; }
  .message-text { line-height: 1.36; }
  .message-meta { gap: 2px; margin-top: 1px; }
  .message-meta .message-action { min-height: 24px; padding: 0 3px; }
  .message-options-button { min-height: 36px; }
  .message-options .button { min-height: 44px; }
  .composer-file .close-button { min-height: 40px; min-width: 40px; }
  .reaction-picker .button { width: 42px; min-height: 42px; }
  .attachment { min-height: 42px; }
  .attach-button { width: 40px; min-height: 40px; margin: 0 1px 1px 0; }
  .sidebar-support .button, .support-back { min-height: 42px; }
  .composer { padding-inline: 8px; }
  .support-topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-topics .button { min-height: 42px; padding-inline: 6px; }
  input, select, textarea, .composer textarea { font-size: 16px; }
}

@media (max-width: 390px) {
  .conversation-header { gap: 4px; }
  .conversation-search, .conversation-shared, .group-notifications { width: 34px; }
  #show-members { padding-inline: 4px; }
  .group-settings-button { width: 34px; }
  #group-archive-section { grid-template-columns: 1fr; }
  #archive-group { justify-self: end; }
  .button-send { max-width: 104px; padding-inline: 7px; }
  .task-details { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
