:root {
  color-scheme: dark;
  --page: #090909;
  --page-soft: #0d0d0d;
  --panel: #111111;
  --panel-raised: #151515;
  --panel-hover: #1a1a1a;
  --line: #282828;
  --line-strong: #3b3b3b;
  --ink: #f1f0ec;
  --ink-soft: #d2d0ca;
  --muted: #96938c;
  --quiet: #696761;
  --inverse: #0c0c0c;
  --white: #f3f2ee;
  --danger: #e8a1a1;
  --danger-bg: #261516;
  --unread: #e45454;
  --success: #d7d5ce;
  --success-bg: #181817;
  --radius: 16px;
  --radius-small: 10px;
  --shadow: 0 34px 100px rgba(0, 0, 0, 0.52);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  scrollbar-color: #3b3b3b var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

::selection {
  background: #deddd8;
  color: #101010;
}

:focus-visible {
  outline: 2px solid #d8d6d0;
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 64px);
  font-weight: 520;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  border-radius: 7px;
  background: var(--white);
  color: var(--inverse);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.wordmark,
.public-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 620;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: 132px;
  border: 0;
  background: transparent;
  object-fit: contain;
  object-position: left center;
}

.brand-logo-topbar {
  height: 34px;
}

.brand-logo-public {
  height: 38px;
  max-width: 154px;
}

.icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon-large {
  width: 44px;
  height: 44px;
}

.auth-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 16% 24%, rgba(255, 255, 255, 0.035), transparent 34%),
    radial-gradient(circle at 82% 76%, rgba(255, 255, 255, 0.02), transparent 30%),
    var(--page);
}

@supports (min-height: 100dvh) {
  .auth-shell {
    min-height: 100dvh;
  }
}

.auth-frame {
  display: grid;
  width: min(100%, 1000px);
  min-height: 580px;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  background: transparent;
  animation: frame-enter 620ms var(--ease-out) both;
}

.public-brand-column {
  display: grid;
  min-width: 0;
  grid-template-rows: auto 1fr auto;
  gap: 52px;
  padding: 46px 54px 46px 24px;
  border-right: 1px solid var(--line);
  background: transparent;
}

.public-brand-column::after {
  display: block;
  height: 38px;
  content: "";
}

.public-brand-column > * {
  animation: content-enter 680ms var(--ease-out) both;
}

.public-brand-column > .public-hero {
  align-self: center;
  animation-delay: 90ms;
}

.public-brand-column > .public-footnote {
  animation-delay: 160ms;
}

.public-brand-column h1 {
  max-width: 440px;
  font-size: clamp(38px, 3.3vw, 44px);
  font-weight: 560;
  letter-spacing: -0.05em;
  line-height: 1.04;
  text-wrap: balance;
}

.public-brand-column .lede {
  max-width: 450px;
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.65;
}

.public-footnote {
  margin: 0;
  color: var(--quiet);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 48px 36px 48px 52px;
  background: transparent;
  animation: content-enter 560ms 100ms var(--ease-out) both;
}

.auth-card-wide {
  padding-top: 32px;
  padding-bottom: 32px;
}

.landing-card {
  text-align: left;
}

.auth-card > h2 {
  margin-bottom: 2px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.section-kicker,
.eyebrow,
.nav-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 690;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--ink-soft);
}

.lede {
  margin: 13px 0 22px;
  color: var(--muted);
}

.lede strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.auth-card label {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 590;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  outline: 0;
  background: #0d0d0d;
  color: var(--ink);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

input {
  height: 46px;
  padding: 0 13px;
}

select {
  height: 40px;
  padding: 0 36px 0 12px;
}

textarea {
  min-height: 260px;
  padding: 15px;
  line-height: 1.65;
  resize: vertical;
}

input,
select,
textarea {
  caret-color: var(--ink);
  color-scheme: dark;
}

input::placeholder,
textarea::placeholder {
  color: #5e5c57;
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #65635e;
  background: #101010;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.055);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
}

input:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 1;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  border-color: var(--line);
  -webkit-box-shadow: 0 0 0 1000px #0d0d0d inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  transition: background-color 9999s ease-out;
}

select option {
  background: var(--panel);
  color: var(--ink);
}

label small,
.small-copy,
.file-summary,
.form-hint {
  color: var(--quiet);
  font-size: 11px;
  font-weight: 430;
}

.file-summary-error {
  color: var(--danger);
}

.small-copy,
.form-hint {
  margin: 14px 0 0;
}

.quiet-link {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-decoration-color: #4c4a46;
  text-underline-offset: 4px;
  transition: color 150ms ease;
}

.quiet-link:hover {
  color: var(--ink);
}

.primary-button,
.secondary-button,
.danger-button,
.compose-button {
  position: relative;
  display: inline-flex;
  min-height: 41px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-weight: 630;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms var(--ease-out);
}

.primary-button .icon,
.secondary-button .icon,
.danger-button .icon,
.compose-button .icon {
  width: 17px;
  height: 17px;
}

.primary-button {
  border-color: var(--white);
  background: var(--white);
  color: var(--inverse);
}

.primary-button:hover {
  border-color: #fff;
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(255, 255, 255, 0.08);
}

.secondary-button {
  border-color: var(--line);
  background: #141414;
  color: var(--ink-soft);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: var(--ink);
  transform: translateY(-1px);
}

.danger-button {
  border-color: #4a292b;
  background: transparent;
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger-bg);
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.compose-button:active {
  transform: translateY(0) scale(0.985);
}

button:disabled,
.is-loading {
  cursor: wait;
  opacity: 0.72;
  pointer-events: none;
}

button.is-loading::after {
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin 650ms linear infinite;
}

.full-button {
  width: 100%;
  min-height: 44px;
  margin-top: 25px;
}

.full-width-button {
  width: 100%;
}

.compact-button {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 11px;
}

.copy-complete {
  border-color: #54524d;
  color: var(--ink);
}

.address-input {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #0d0d0d;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.address-input:focus-within {
  border-color: #65635e;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.055);
}

.address-input input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.address-input > span {
  padding: 0 13px 0 10px;
  color: var(--muted);
  font-weight: 470;
  white-space: nowrap;
}

.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 17px 0 2px;
  padding: 11px 13px;
  border: 1px solid;
  border-radius: var(--radius-small);
  font-size: 12px;
  line-height: 1.5;
  animation: notice-enter 420ms var(--ease-out) both;
}

.notice .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.notice-success {
  border-color: #3a3936;
  background: var(--success-bg);
  color: var(--success);
}

.notice-error {
  border-color: #573032;
  background: var(--danger-bg);
  color: #efb3b3;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  height: 68px;
  align-items: center;
  grid-template-columns: 224px minmax(280px, 1fr) auto;
  gap: 26px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 9, 0.92);
  backdrop-filter: blur(22px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.015);
  animation: topbar-enter 520ms var(--ease-out) both;
}

.mailbox-switcher {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mailbox-switcher select {
  min-width: 0;
  text-overflow: ellipsis;
}

.mailbox-switcher > .icon {
  color: var(--quiet);
}

.mailbox-switcher select {
  width: min(100%, 430px);
  border-color: transparent;
  border-radius: 8px;
  background-color: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.mailbox-switcher select:hover,
.mailbox-switcher select:focus {
  border-color: transparent;
  background-color: #151515;
  box-shadow: none;
}

.topbar-actions,
.topbar-actions form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.topbar-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}

.topbar-link:hover,
.topbar-link.active {
  background: #171717;
  color: var(--ink);
}

.topbar-link:hover {
  transform: translateY(-1px);
}

.topbar-link .icon {
  width: 16px;
  height: 16px;
}

.notification-button {
  position: relative;
  width: 34px;
  justify-content: center;
  padding: 7px;
}

.notification-button.is-enabled {
  color: var(--ink);
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 5px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--page);
  border-radius: 50%;
  background: var(--unread);
}

.mail-layout {
  display: grid;
  min-height: calc(100vh - 68px);
  grid-template-columns: 240px minmax(0, 1fr);
}

.mail-sidebar {
  position: sticky;
  top: 68px;
  display: flex;
  height: calc(100vh - 68px);
  flex-direction: column;
  padding: 24px 15px 17px;
  border-right: 1px solid var(--line);
  background: #0c0c0c;
  animation: sidebar-enter 580ms 60ms var(--ease-out) both;
}

.compose-button {
  justify-content: flex-start;
  margin: 0 4px 28px;
  padding-left: 14px;
  border-color: #e7e5df;
  background: #e7e5df;
  color: #0d0d0d;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.compose-button:hover {
  background: #fff;
  transform: translateY(-1px);
}

.nav-label {
  margin: 0 13px 8px;
  color: #5e5c57;
}

.mail-sidebar nav {
  display: grid;
  gap: 2px;
}

.mail-sidebar nav a {
  display: flex;
  min-height: 41px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms var(--ease-out);
}

.mail-sidebar nav a:hover {
  background: #141414;
  color: var(--ink-soft);
  transform: translateX(2px);
}

.mail-sidebar nav a.active {
  border-color: #292929;
  background: #181818;
  color: var(--ink);
}

.mail-sidebar nav strong {
  min-width: 21px;
  padding: 1px 6px;
  border-radius: 9px;
  background: rgba(228, 84, 84, 0.14);
  color: #f07878;
  font-size: 10px;
  text-align: center;
}

.nav-item-copy {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.nav-item-copy .icon {
  width: 17px;
  height: 17px;
  color: #77746e;
}

.mail-sidebar nav a.active .nav-item-copy .icon {
  color: var(--ink);
}

.sidebar-account {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  margin-top: auto;
  padding: 14px 12px 2px;
  border-top: 1px solid var(--line);
}

.sidebar-account > span:last-child {
  display: grid;
  min-width: 0;
}

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

.sidebar-account strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.sidebar-account small {
  color: var(--quiet);
  font-size: 10px;
}

.sidebar-account-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--muted);
}

.sidebar-account-icon .icon {
  width: 12px;
  height: 12px;
}

.sidebar-scrim {
  display: none;
}

[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

.app-toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  display: grid;
  min-width: 290px;
  max-width: min(390px, calc(100vw - 32px));
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #353535;
  border-radius: 12px;
  background: rgba(22, 22, 22, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  text-align: left;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 220ms var(--ease-out);
  backdrop-filter: blur(18px);
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast[hidden] {
  display: none;
}

.app-toast > .icon {
  color: var(--unread);
}

.app-toast > span {
  display: grid;
  min-width: 0;
}

.app-toast strong,
.app-toast small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-toast strong {
  font-size: 12px;
}

.app-toast small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.mail-content {
  min-width: 0;
  width: min(100%, 1260px);
  margin: 0 auto;
  padding: 44px 52px 82px;
  animation: content-enter 540ms 100ms var(--ease-out) both;
}

.mail-heading,
.message-toolbar,
.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.mail-heading {
  margin-bottom: 28px;
}

.mail-heading > div {
  min-width: 0;
}

.mail-heading h1 {
  font-size: 38px;
  font-weight: 530;
  letter-spacing: -0.045em;
  line-height: 1;
}

.page-description {
  margin: 10px 0 0;
  color: var(--muted);
}

.mailbox-context {
  margin: 8px 0 0;
  color: var(--quiet);
  font-size: 12px;
}

.icon-action {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}

.icon-action:hover {
  background: var(--panel-hover);
  color: var(--ink);
  transform: translateY(-1px);
}

.message-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.message-row {
  position: relative;
  display: grid;
  min-height: 70px;
  align-items: center;
  grid-template-columns: 9px minmax(125px, 190px) minmax(0, 1fr) auto auto auto;
  gap: 15px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: background 150ms ease, transform 150ms var(--ease-out);
}

.message-row:last-child {
  border-bottom: 0;
}

.message-row:hover {
  background: #141414;
}

.message-row.unread {
  background: #121212;
  color: var(--ink);
}

.message-row.unread::before {
  display: none;
}

.message-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--unread);
  box-shadow: 0 0 0 3px rgba(228, 84, 84, 0.08);
}

.message-state-dot.read {
  background: transparent;
  box-shadow: none;
}

.sender,
.message-summary strong,
.message-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender {
  color: var(--ink-soft);
  font-weight: 590;
}

.message-summary {
  display: flex;
  min-width: 0;
  gap: 10px;
}

.message-summary strong {
  flex: 0 1 auto;
  color: var(--ink-soft);
  font-size: 13px;
}

.message-summary span {
  flex: 1 1 auto;
  color: var(--quiet);
}

.message-row time {
  color: var(--quiet);
  font-size: 11px;
  white-space: nowrap;
}

.attachment-indicator {
  color: var(--muted);
}

.attachment-indicator .icon {
  width: 16px;
  height: 16px;
}

.delivery-status,
.neutral-badge,
.role-badge {
  padding: 3px 8px;
  border: 1px solid #343434;
  border-radius: 999px;
  background: #181818;
  color: var(--muted);
  font-size: 9px;
  font-weight: 640;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-failed {
  border-color: #4a292b;
  background: var(--danger-bg);
  color: var(--danger);
}

.status-sent,
.active-badge {
  border-color: #4b4a46;
  color: var(--ink-soft);
}

.empty-state {
  display: grid;
  min-height: 410px;
  place-items: center;
  align-content: center;
  padding: 30px;
  border: 0;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin-top: 14px;
  color: var(--ink);
}

.empty-state p {
  max-width: 380px;
  margin: 7px 0 20px;
}

.empty-symbol {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid #2e2e2e;
  border-radius: 20px;
  background: #111;
  color: #66635d;
  animation: empty-float 4.5s ease-in-out infinite;
}

.mobile-nav-button {
  display: none;
}

.message-view {
  min-width: 0;
  max-width: 1080px;
}

.message-toolbar {
  margin-bottom: 32px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-actions form {
  margin: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: color 150ms ease, transform 150ms var(--ease-out);
}

.back-link:hover {
  color: var(--ink);
  transform: translateX(-2px);
}

.back-link .icon {
  width: 16px;
  height: 16px;
}

.message-header {
  min-width: 0;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.message-header h1 {
  max-width: 900px;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.1;
}

.message-state-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.message-state-line .eyebrow {
  margin: 0;
}

.message-meta {
  display: grid;
  align-items: start;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
  margin-top: 29px;
  color: var(--muted);
}

.message-meta p {
  margin: 0 0 3px;
  color: var(--ink);
}

.message-sender {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.message-sender strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-sender span {
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 450;
  overflow-wrap: anywhere;
}

.message-sender-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #3c3b38;
  border-radius: 11px;
  background: #181818;
  color: var(--ink-soft);
}

.message-sender-icon .icon {
  width: 18px;
  height: 18px;
}

details summary {
  width: fit-content;
  color: var(--quiet);
  cursor: pointer;
  font-size: 11px;
  transition: color 150ms ease;
}

details summary:hover {
  color: var(--ink-soft);
}

details dl {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--panel);
}

details dl div,
.detail-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
}

dt {
  color: var(--quiet);
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.message-body {
  width: 100%;
  min-width: 0;
  min-height: 190px;
  padding: 40px 2px 46px;
  color: #deddd8;
  font-size: 15.5px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  word-break: normal;
}

.email-plain {
  white-space: pre-wrap;
}

.message-body .email-link {
  color: #f1f0ec;
  font-weight: 560;
  text-decoration-color: #77746e;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

.message-body .email-link:hover {
  color: #fff;
  text-decoration-color: #f1f0ec;
}

.email-rich {
  white-space: normal;
}

.email-rich > :first-child {
  margin-top: 0 !important;
}

.email-rich > :last-child {
  margin-bottom: 0 !important;
}

.email-rich h1,
.email-rich h2,
.email-rich h3,
.email-rich h4,
.email-rich h5,
.email-rich h6 {
  max-width: 100%;
  margin: 1.55em 0 0.55em;
  color: #f0efeb;
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.email-rich h1 {
  font-size: 27px;
}

.email-rich h2 {
  font-size: 23px;
}

.email-rich h3 {
  font-size: 19px;
}

.email-rich h4,
.email-rich h5,
.email-rich h6 {
  font-size: 16px;
}

.email-rich p,
.email-rich div {
  max-width: 100%;
}

.email-rich p {
  margin: 0 0 1.05em;
}

.email-rich ul,
.email-rich ol {
  margin: 0.8em 0 1.25em;
  padding-left: 1.45em;
}

.email-rich li {
  margin: 0.3em 0;
  padding-left: 0.15em;
}

.email-rich blockquote {
  margin: 1.25em 0;
  padding: 2px 0 2px 17px;
  border-left: 2px solid #4a4945;
  color: var(--muted);
}

.email-rich pre,
.email-rich code {
  border-radius: 6px;
  background: #141414;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.email-rich code {
  padding: 0.15em 0.35em;
}

.email-rich pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 16px;
  white-space: pre;
}

.email-rich pre code {
  padding: 0;
  background: transparent;
}

.email-rich hr {
  height: 1px;
  margin: 28px 0;
  border: 0;
  background: var(--line);
}

.email-rich center {
  max-width: 100%;
  text-align: center;
}

.email-rich table {
  width: auto;
  max-width: 100%;
  margin: 0;
  border-spacing: 0;
  border-collapse: collapse;
  background: transparent;
  color: inherit;
}

.email-rich caption {
  margin-bottom: 8px;
  color: var(--muted);
  text-align: left;
}

.email-rich td,
.email-rich th {
  min-width: 0;
  max-width: 100%;
  padding: 4px 0;
  color: inherit;
  text-align: inherit;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.email-rich th {
  font-weight: 650;
}

.email-rich img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 0;
}

.email-image-alt {
  display: inline;
  color: var(--muted);
  font-size: 0.92em;
}

.email-current-content,
.email-quoted-body {
  white-space: pre-wrap;
}

.email-quoted {
  margin: 26px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.email-quoted > summary {
  width: fit-content;
  cursor: pointer;
  color: #c4c2bc;
  font-size: 13px;
  font-weight: 650;
  list-style-position: outside;
  transition: color 140ms ease;
}

.email-quoted > summary:hover {
  color: #f4f3ef;
}

.email-quoted-body {
  margin-top: 16px;
  padding-left: 16px;
  border-left: 2px solid #343330;
  color: #aaa8a2;
  font-size: 0.94em;
}

.email-remote-image {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  margin: 4px 0;
  padding: 5px 9px;
  border: 1px solid #302f2c;
  border-radius: 7px;
  background: #111;
  color: #8f8d87;
  font-size: 12px;
}

.remote-content-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 28px;
  padding: 12px 14px;
  border: 1px solid #302f2c;
  border-radius: 10px;
  background: #101010;
}

.remote-content-notice > div {
  display: grid;
  gap: 2px;
}

.remote-content-notice strong {
  color: #d8d6d0;
  font-size: 13px;
}

.remote-content-notice small {
  color: #77756f;
  font-size: 11px;
}

.remote-content-notice .secondary-button {
  min-height: 34px;
  padding: 6px 11px;
  white-space: nowrap;
}

.remote-content-error {
  border-color: #4a2b2b;
  color: #c78e8e;
}

.message-body .email-action-link {
  display: inline-flex;
  min-height: 43px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  padding: 10px 16px;
  border: 1px solid #eeede8;
  border-radius: 9px;
  background: #eeede8;
  color: #0e0e0e;
  font-size: 14px;
  font-weight: 680;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition: background 140ms ease, border-color 140ms ease, transform 160ms var(--ease-out);
}

.message-body .email-action-link:hover {
  border-color: #fff;
  background: #fff;
  color: #080808;
  transform: translateY(-1px);
}

.attachments {
  padding: 25px 0;
  border-top: 1px solid var(--line);
}

.attachments h2 {
  margin-bottom: 14px;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.attachment-grid a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--panel);
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms var(--ease-out);
}

.attachment-grid a:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  transform: translateY(-1px);
}

.attachment-grid span:last-child {
  display: grid;
  min-width: 0;
}

.attachment-grid strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-grid small {
  color: var(--quiet);
}

.file-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #1e1e1e;
  color: var(--ink-soft);
}

.file-icon .icon {
  width: 16px;
  height: 16px;
}

.message-footer {
  display: flex;
  gap: 10px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.compose-view {
  max-width: 1080px;
}

.compose-form {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.24);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.compose-form:focus-within {
  border-color: #353535;
  box-shadow: 0 26px 74px rgba(0, 0, 0, 0.36);
}

.compose-line {
  display: grid;
  min-height: 48px;
  align-items: center;
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
  color: var(--quiet);
}

.compose-line input {
  height: 47px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.body-field textarea {
  min-height: clamp(200px, calc(100vh - 520px), 360px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.compose-footer {
  min-height: 64px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.compose-footer > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.attachment-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink-soft);
  cursor: pointer;
  gap: 8px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms var(--ease-out);
}

.attachment-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  transform: translateY(-1px);
}

.attachment-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.settings-view {
  max-width: 1220px;
}

.settings-heading {
  align-items: flex-end;
}

.role-badge {
  margin-bottom: 3px;
}

.mailbox-list {
  display: grid;
  margin-top: 6px;
}

.mailbox-list-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.mailbox-list-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #393836;
  border-radius: 8px;
  background: #181818;
  color: var(--muted);
}

.mailbox-list-icon .icon {
  width: 16px;
  height: 16px;
}

.mailbox-list-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.mailbox-list-copy strong,
.mailbox-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-list-copy strong {
  color: var(--ink-soft);
  font-size: 12px;
}

.mailbox-list-copy small {
  color: var(--quiet);
  font-size: 11px;
}

.inline-create-form {
  margin-top: 22px;
  padding-top: 4px;
}

.inline-create-form .field-pair {
  grid-template-columns: 1fr;
  gap: 0;
}

.inline-create-form .secondary-button {
  margin-top: 18px;
}

.compact-address-input > span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invite-result {
  display: grid;
  gap: 17px;
  padding: 17px;
  border: 1px solid #474642;
  border-radius: var(--radius-small);
  background: #181818;
  animation: notice-enter 420ms var(--ease-out) both;
}

.invite-result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.invite-result-heading p,
.invite-security-note {
  margin: 0;
  color: var(--quiet);
  font-size: 11px;
}

.invite-ready-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid #45443f;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 640;
}

.invite-ready-badge .icon {
  width: 13px;
  height: 13px;
}

.invite-copy-grid {
  display: grid;
  gap: 12px;
}

.invite-copy-grid label {
  min-width: 0;
}

.copy-field {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-field input {
  height: 38px;
  min-width: 0;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-field input[readonly] {
  background: #0b0b0b;
  color: var(--ink-soft);
}

.copy-field .secondary-button {
  min-width: 100px;
}

.invite-security-note {
  padding-top: 1px;
}

.settings-view {
  max-width: 1040px;
}

.settings-heading {
  align-items: flex-end;
  margin-bottom: 34px;
}

.settings-stack {
  border-top: 1px solid var(--line);
}

.settings-section {
  margin: 0;
  padding: 30px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.settings-section label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 590;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 20px;
}

.settings-section-heading > .icon,
.settings-heading-copy > .icon {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  color: var(--muted);
}

.settings-section-heading h2 {
  font-size: 18px;
}

.settings-section-heading p {
  margin: 3px 0 0;
  color: var(--quiet);
  font-size: 12px;
}

.settings-section-heading-with-count {
  align-items: flex-start;
  justify-content: space-between;
}

.settings-heading-copy {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.settings-heading-copy > span {
  display: grid;
}

.settings-count {
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 580;
}

.settings-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.settings-search {
  position: relative;
  width: min(100%, 360px);
}

.settings-search .icon {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  width: 15px;
  height: 15px;
  color: var(--quiet);
  pointer-events: none;
  transform: translateY(-50%);
}

.settings-search input {
  height: 38px;
  padding-right: 34px;
  padding-left: 34px;
  border-color: #2b2b2b;
  background: #0b0b0b;
  font-size: 12px;
}

.settings-search-count {
  flex: 0 0 auto;
  color: var(--quiet);
  font-size: 11px;
}

.settings-filter-empty {
  margin: 18px 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.settings-rows {
  margin: 0;
}

.settings-row,
.settings-action-row {
  display: grid;
  min-height: 50px;
  align-items: center;
  grid-template-columns: minmax(170px, 0.42fr) minmax(0, 1fr);
  gap: 24px;
  border-top: 1px solid #202020;
}

.settings-row:first-child {
  border-top: 0;
}

.settings-row dt {
  color: var(--quiet);
}

.settings-row dd {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.settings-action-row {
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
}

.settings-action-row > div {
  display: grid;
  gap: 2px;
}

.settings-action-row strong {
  color: var(--ink-soft);
  font-size: 12px;
}

.settings-action-row span {
  color: var(--quiet);
  font-size: 11px;
}

.settings-action-row .secondary-button {
  flex: 0 0 auto;
}

.settings-section .mailbox-list {
  max-height: 420px;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 1px solid #202020;
}

.settings-section .mailbox-list-row {
  min-height: 58px;
  padding: 9px 2px;
  border-bottom-color: #202020;
}

.settings-section .mailbox-list-row[hidden] {
  display: none;
}

.settings-section .mailbox-list-icon {
  width: 25px;
  height: 25px;
  border: 0;
  background: transparent;
  color: var(--quiet);
}

.settings-section .mailbox-list-copy strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 560;
}

.settings-section .mailbox-list-copy small {
  margin-top: 1px;
  font-size: 10px;
}

.mailbox-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mailbox-row-actions form {
  margin: 0;
}

.mailbox-open-button {
  min-height: 30px;
  padding: 5px 9px;
}

.mailbox-open-button .icon {
  width: 14px;
  height: 14px;
}

.settings-disclosure {
  margin-top: 18px;
}

.settings-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 620;
  list-style: none;
  transition: color 150ms ease;
}

.settings-disclosure > summary::-webkit-details-marker {
  display: none;
}

.settings-disclosure > summary:hover {
  color: var(--ink);
}

.settings-disclosure > summary .icon {
  width: 16px;
  height: 16px;
  transition: transform 180ms var(--ease-out);
}

.settings-disclosure[open] > summary .icon {
  transform: rotate(45deg);
}

.settings-section .inline-create-form {
  max-width: 760px;
  margin-top: 20px;
  padding: 2px 0 0 22px;
  border-left: 1px solid var(--line-strong);
}

.settings-section .inline-create-form .field-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-section .inline-create-form .primary-button {
  margin-top: 16px;
}

.settings-action-form {
  margin: 0;
}

.invite-create-form {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 15px;
}

.invite-create-form p {
  margin: 0;
  color: var(--quiet);
  font-size: 11px;
}

.settings-section .invite-result {
  border-color: #383838;
  background: #111;
}

.password-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.password-section > .secondary-button {
  margin-top: 18px;
}

.error-card {
  width: min(100%, 460px);
  min-height: 420px;
  margin: auto;
  padding: 52px 42px;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
}

.error-card h1 {
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1.04;
  text-wrap: balance;
}

.error-copy {
  margin: 16px 0 2px;
  color: var(--muted);
}

.error-card .public-wordmark {
  justify-content: center;
  margin-bottom: 40px;
}

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

@keyframes frame-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

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

@keyframes sidebar-enter {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes empty-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@media (max-width: 980px) {
  .auth-frame {
    width: min(100%, 560px);
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .public-brand-column {
    min-height: 210px;
    gap: 44px;
    padding: 30px 38px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .public-brand-column::after {
    display: none;
  }

  .public-brand-column h1 {
    margin-top: 0;
    font-size: 38px;
  }

  .public-footnote {
    display: none;
  }

  .auth-card {
    padding: 38px;
  }

  .topbar {
    grid-template-columns: auto minmax(220px, 1fr) auto;
  }

  .wordmark-name {
    display: none;
  }

  .account-summary-card,
  .invite-card {
    grid-column: span 12;
  }

  .mailbox-card {
    grid-column: span 12;
    grid-row: auto;
  }

  .password-fields {
    grid-template-columns: 1fr 1fr;
  }

  .password-fields label:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .auth-shell {
    padding: 0;
    background: var(--page);
  }

  .auth-frame {
    min-height: 100vh;
    align-content: stretch;
    border: 0;
    border-radius: 0;
  }

  .public-brand-column {
    min-height: 0;
    gap: 36px;
    padding: 26px 24px;
  }

  .public-brand-column h1 {
    margin-top: 0;
    font-size: 34px;
  }

  .public-brand-column .lede {
    display: none;
  }

  .auth-card {
    padding: 32px 24px 46px;
  }

  .field-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .topbar {
    height: 62px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 13px;
  }

  .mailbox-switcher {
    justify-content: stretch;
  }

  .mailbox-switcher label {
    display: none;
  }

  .mailbox-switcher select {
    min-width: 0;
    height: 36px;
  }

  .topbar-actions {
    gap: 0;
  }

  .topbar-actions .topbar-link {
    padding: 7px;
  }

  .topbar-actions .topbar-link > span:not(.notification-dot) {
    display: none;
  }

  .mail-layout {
    min-height: calc(100vh - 62px);
    grid-template-columns: minmax(0, 1fr);
  }

  .mail-sidebar {
    position: fixed;
    z-index: 30;
    top: 62px;
    left: 0;
    width: min(84vw, 270px);
    height: calc(100vh - 62px);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    animation: none;
    transition: transform 220ms var(--ease-out);
  }

  .mail-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 29;
    inset: 62px 0 0;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mail-content {
    padding: 28px 17px max(52px, env(safe-area-inset-bottom));
  }

  .mobile-nav-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .mobile-nav-button .icon {
    width: 15px;
    height: 15px;
  }

  .message-row {
    grid-template-columns: 7px minmax(90px, 0.45fr) minmax(0, 1fr) auto;
    gap: 11px;
  }

  .message-summary {
    display: grid;
    gap: 2px;
  }

  .attachment-indicator,
  .delivery-status {
    display: none;
  }

  .message-toolbar {
    align-items: flex-start;
    margin-bottom: 27px;
  }

  .toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .toolbar-actions button {
    min-height: 35px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .message-header {
    padding-bottom: 23px;
  }

  .message-header h1 {
    font-size: clamp(27px, 8vw, 34px);
  }

  .message-meta {
    margin-top: 23px;
  }

  .message-body {
    min-height: 160px;
    padding: 29px 0 36px;
    font-size: 15.5px;
    line-height: 1.68;
  }

  .email-rich table {
    width: 100%;
  }

  .email-rich h1 {
    font-size: 24px;
  }

  .email-rich h2 {
    font-size: 21px;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 0;
  }

  .settings-section .inline-create-form .field-pair,
  .password-fields {
    grid-template-columns: 1fr;
  }

  .password-fields label:first-child {
    grid-column: auto;
  }

  .app-toast {
    right: 16px;
    bottom: 16px;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .topbar .wordmark {
    max-width: 48px;
  }

  .brand-logo-topbar {
    max-width: 48px;
    height: 28px;
  }

  .mailbox-switcher {
    gap: 0;
  }

  .mailbox-switcher > .icon {
    display: none;
  }

  .mailbox-switcher select {
    padding-right: 24px;
    padding-left: 8px;
    font-size: 12px;
  }

  .message-toolbar {
    align-items: center;
    gap: 12px;
  }

  .toolbar-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .toolbar-actions .message-action-button {
    width: 38px;
    min-height: 38px;
    justify-content: center;
    padding: 8px;
  }

  .toolbar-actions .message-action-button > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .message-state-line {
    margin-bottom: 7px;
  }

  .message-header h1 {
    font-size: 27px;
  }

  .message-meta {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 11px;
  }

  .message-sender-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .message-body {
    padding-top: 26px;
    padding-bottom: 32px;
  }

  .message-body .email-action-link {
    width: 100%;
    min-height: 46px;
    padding: 11px 15px;
  }

  .attachment-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .message-footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  }

  .message-footer a {
    min-height: 46px;
    justify-content: center;
  }

  .public-brand-column h1 {
    font-size: 32px;
  }

  .public-brand-column {
    gap: 30px;
    padding: 22px 20px;
  }

  .auth-card {
    padding: 28px 20px 42px;
  }

  .auth-card > h2 {
    font-size: 22px;
  }

  .auth-card label {
    margin-top: 16px;
  }

  .address-input > span {
    max-width: 58vw;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
  }

  .full-button {
    min-height: 46px;
  }

  .error-card {
    width: calc(100% - 32px);
    min-height: 400px;
    padding: 42px 24px;
  }

  .error-card h1 {
    font-size: 34px;
  }

  .mail-heading {
    align-items: flex-end;
  }

  .mail-heading h1 {
    font-size: 32px;
  }

  .icon-button-on-mobile {
    width: 40px;
    min-height: 40px;
    padding: 9px;
  }

  .icon-button-on-mobile > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .message-row {
    min-height: 74px;
    grid-template-columns: 7px minmax(0, 1fr) auto;
  }

  .sender {
    grid-column: 2;
  }

  .message-summary {
    grid-column: 2;
  }

  .message-row time {
    grid-row: 1;
    grid-column: 3;
  }

  .message-state-dot {
    grid-row: 1 / span 2;
    grid-column: 1;
  }

  .compose-footer {
    align-items: flex-end;
  }

  .compose-footer > div {
    display: grid;
    gap: 4px;
  }

  details dl div,
  .detail-list div {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .mailbox-list-row {
    flex-wrap: wrap;
  }

  .mailbox-list-copy {
    flex-basis: calc(100% - 44px);
  }

  .mailbox-row-actions {
    width: calc(100% - 35px);
    justify-content: flex-end;
    margin-left: 35px;
  }

  .settings-action-row {
    display: grid;
    align-items: start;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .settings-action-row .secondary-button {
    width: fit-content;
  }

  .settings-heading-copy {
    min-width: 0;
  }

  .settings-section-heading-with-count {
    gap: 16px;
  }

  .settings-section .inline-create-form {
    padding-left: 0;
    border-left: 0;
  }

  .settings-list-toolbar,
  .invite-result-heading,
  .invite-create-form {
    display: grid;
    justify-items: start;
  }

  .settings-search {
    width: 100%;
  }

  .invite-result-heading {
    gap: 8px;
  }

  .invite-create-form {
    gap: 9px;
  }
}

/* Unified navigation, security surfaces, and encrypted delivery */

.topbar {
  grid-template-columns: minmax(160px, 190px) auto minmax(220px, 1fr) auto;
  gap: 18px;
}

.product-switcher {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #252525;
  border-radius: 9px;
  background: #0d0d0d;
}

.product-switcher a {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 620;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease;
}

.product-switcher a:hover {
  color: var(--ink-soft);
}

.product-switcher a.active {
  background: #202020;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.product-switcher .icon {
  width: 15px;
  height: 15px;
}

.delivery-mode {
  display: grid;
  margin: 0;
  padding: 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.delivery-mode legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.delivery-mode label {
  position: relative;
  cursor: pointer;
}

.delivery-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.delivery-mode label > span {
  display: grid;
  min-height: 56px;
  align-content: center;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 9px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--quiet);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.delivery-mode label:hover > span {
  background: #151515;
  color: var(--ink-soft);
}

.delivery-mode input:checked + span {
  border-color: #353535;
  background: #1a1a1a;
  color: var(--ink);
}

.delivery-mode input:focus-visible + span {
  outline: 2px solid #d8d6d0;
  outline-offset: 2px;
}

.delivery-mode .icon {
  width: 17px;
  height: 17px;
  align-self: center;
  grid-row: 1 / span 2;
}

.delivery-mode strong {
  font-size: 11px;
  font-weight: 650;
}

.delivery-mode small {
  color: var(--quiet);
  font-size: 10px;
}

.delivery-security-copy {
  margin: 0;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--quiet);
  font-size: 11px;
}

.pgp-compose-options {
  display: grid;
  gap: 9px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: #0d0d0d;
}

.pgp-compose-options[hidden] {
  display: none;
}

.pgp-compose-options label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 620;
}

.pgp-compose-options textarea {
  min-height: 100px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.pgp-compose-options p {
  margin: 0;
  color: var(--quiet);
  font-size: 10px;
}

.inline-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.inline-status[data-kind="error"],
.dialog-status[data-kind="error"],
.chat-composer-status[data-kind="error"] {
  color: #eba7a7;
}

.inline-status[data-kind="success"],
.dialog-status[data-kind="success"],
.chat-composer-status[data-kind="success"] {
  color: #d9d7d0;
}

.compose-security-status {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.settings-compact-form {
  max-width: 520px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #202020;
}

.settings-inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.settings-inline-control input {
  min-width: 0;
}

.security-control-center {
  scroll-margin-top: 82px;
}

.security-state-badge {
  max-width: 360px;
  padding: 5px 9px;
  border: 1px solid #333;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 620;
  line-height: 1.3;
  text-align: right;
}

.security-state-badge[data-kind="success"] {
  border-color: #46453f;
  color: var(--ink-soft);
}

.security-state-badge[data-kind="warning"],
.security-state-badge[data-kind="error"] {
  border-color: #573234;
  color: #e5aaaa;
}

.security-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 0;
  border-top: 1px solid #202020;
  border-bottom: 1px solid #202020;
}

.security-callout > div {
  max-width: 650px;
}

.security-callout strong,
.settings-subsection h3 {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.security-callout p,
.settings-subsection p,
.privacy-explainer p {
  margin: 4px 0 0;
  color: var(--quiet);
  font-size: 11px;
}

.recovery-unlock-form {
  display: grid;
  max-width: 640px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 18px 0;
}

.recovery-unlock-form[hidden] {
  display: none;
}

.recovery-unlock-form .inline-status {
  grid-column: 1 / -1;
}

.settings-subsection {
  padding-top: 20px;
}

.settings-subsection header {
  margin-bottom: 10px;
}

.security-device-list {
  border-top: 1px solid #202020;
}

.contacts-panel {
  margin-top: 4px;
}

.contact-list {
  border-top: 1px solid #202020;
}

.contact-row {
  display: grid;
  min-height: 64px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px solid #202020;
}

.contact-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.contact-copy strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 620;
}

.contact-copy small,
.contact-note,
.contact-empty {
  overflow: hidden;
  color: var(--quiet);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-note {
  margin-top: 2px;
}

.contact-actions {
  display: flex;
  gap: 7px;
}

.contact-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.contact-empty {
  margin: 13px 0 0;
}

.contact-empty[hidden] {
  display: none;
}

.contact-form {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

.contact-form[hidden] {
  display: none;
}

.contact-fields {
  display: grid;
  grid-template-columns: minmax(130px, 0.65fr) minmax(190px, 1fr) minmax(150px, 1fr);
  gap: 10px;
}

.security-device-row,
.security-session-row {
  display: grid;
  min-height: 64px;
  align-items: center;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid #202020;
}

.security-device-row.is-revoked {
  opacity: 0.56;
}

.security-device-icon {
  display: grid;
  width: 32px;
  height: 32px;
  border: 1px solid #303030;
  border-radius: 9px;
  background: #111;
  color: var(--muted);
  place-items: center;
}

.security-device-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.security-device-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.security-device-copy strong {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 610;
}

.security-device-copy small {
  overflow: hidden;
  color: var(--quiet);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiet-button,
.quiet-danger-button,
.member-manage-button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #303030;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.quiet-danger-button {
  border-color: #472a2c;
  color: #d99a9a;
}

.quiet-button:hover,
.member-manage-button:hover {
  border-color: #474747;
  color: var(--ink);
}

.quiet-danger-button:hover {
  border-color: #6a3a3e;
  background: #1b1112;
}

.status-pill {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid #3a3a37;
  border-radius: 999px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  vertical-align: middle;
}

.security-event-list {
  border-top: 1px solid #202020;
}

.security-event-row {
  display: grid;
  min-height: 54px;
  align-items: center;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 11px;
  padding: 9px 2px;
  border-bottom: 1px solid #202020;
}

.security-event-marker {
  width: 6px;
  height: 6px;
  border: 1px solid #77746d;
  border-radius: 50%;
}

.severity-warning .security-event-marker {
  border-color: #c47d7d;
  background: #5e292d;
}

.security-event-row > span:last-child {
  display: grid;
  gap: 2px;
}

.security-event-row strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 610;
}

.security-event-row small {
  color: var(--quiet);
  font-size: 10px;
}

.privacy-explainer {
  margin: 0 0 16px;
  padding: 13px 15px;
  border-left: 2px solid #3c3b38;
  background: #0d0d0d;
}

.pgp-generate-form {
  display: grid;
  max-width: 760px;
  gap: 12px;
}

.pgp-generate-form .field-pair {
  margin: 0;
}

.pgp-generate-form > .secondary-button {
  width: fit-content;
}

.privacy-rows > div {
  display: grid;
  min-height: 58px;
  align-items: start;
  grid-template-columns: minmax(150px, 0.28fr) minmax(0, 1fr);
  gap: 22px;
  padding: 12px 0;
  border-top: 1px solid #202020;
}

.privacy-rows dt {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 610;
}

.privacy-rows dd {
  margin: 0;
  color: var(--quiet);
  font-size: 11px;
}

.danger-disclosure {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid #382326;
}

.danger-disclosure > summary {
  width: fit-content;
  color: #dc9898;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.danger-disclosure form {
  display: grid;
  max-width: 560px;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #46282b;
  border-radius: 10px;
  background: #110b0c;
}

.danger-disclosure form p {
  margin: 0;
  color: #b78383;
  font-size: 11px;
}

.danger-disclosure .danger-button {
  width: fit-content;
}

.recovery-dialog,
.app-dialog {
  width: min(calc(100% - 32px), 520px);
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #353535;
  border-radius: 14px;
  background: #101010;
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.75);
}

.recovery-dialog::backdrop,
.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(7px);
}

.recovery-dialog-card,
.dialog-card {
  padding: 26px;
}

.recovery-dialog-card h2 {
  margin-top: 5px;
}

.recovery-dialog-card > p {
  margin: 11px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.recovery-dialog-card label {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 620;
}

.recovery-dialog-card textarea {
  resize: none;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.check-row,
.recovery-dialog-card .check-row {
  display: flex;
  align-items: flex-start;
  grid-template-columns: none;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.check-row input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: #e6e4dd;
}

.secure-message-body {
  min-height: 180px;
}

.secure-message-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px 9px;
  border: 1px solid #353535;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.secure-message-state .icon {
  width: 14px;
  height: 14px;
}

.secure-message-state [data-kind="error"] {
  color: #e7a0a0;
}

.secure-message-state [data-kind="success"] {
  color: var(--ink-soft);
}

.secure-decrypted-body {
  max-width: 780px;
  color: #dcdbd6;
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.secure-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.secure-attachment {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #131313;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
}

.pgp-decrypt-panel {
  margin: 0 0 28px;
  padding: 0 8px;
}

.pgp-decrypt-panel details {
  border: 1px solid #323232;
  border-radius: 10px;
  background: #101010;
}

.pgp-decrypt-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  list-style: none;
}

.pgp-decrypt-panel summary .icon {
  width: 15px;
  height: 15px;
}

.pgp-decrypt-panel form {
  display: grid;
  gap: 12px;
  padding: 0 13px 14px;
}

.pgp-decrypt-panel form > p {
  margin: 0;
  color: var(--quiet);
  font-size: 10px;
}

.pgp-decrypt-panel label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 620;
}

.pgp-decrypt-panel textarea {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.pgp-plaintext {
  max-height: 460px;
  margin: 0;
  padding: 15px;
  overflow: auto;
  border: 1px solid #2b2b2b;
  border-radius: 8px;
  background: #090909;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Chat */

.chat-shell {
  display: grid;
  height: calc(100vh - 68px);
  min-height: 560px;
  overflow: hidden;
  grid-template-columns: 72px 256px minmax(0, 1fr);
  background: #0a0a0a;
}

.chat-shell button,
.chat-shell input,
.chat-shell textarea {
  font-size: inherit;
}

.chat-server-rail {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  padding: 13px 9px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid #242424;
  background: #080808;
  scrollbar-width: none;
}

.chat-server-rail::-webkit-scrollbar {
  display: none;
}

.chat-server-buttons {
  display: contents;
}

.chat-rail-button {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #2c2c2c;
  border-radius: 13px;
  background: #151515;
  color: #aaa79f;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  place-items: center;
  transition: border-radius 180ms var(--ease-out), background 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}

.chat-rail-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-rail-button:hover,
.chat-rail-button.is-active {
  border-color: #4a4945;
  border-radius: 10px;
  background: #e8e6df;
  color: #111;
  transform: translateY(-1px);
}

.chat-rail-button.is-active::before {
  position: absolute;
  top: 9px;
  left: -10px;
  width: 3px;
  height: 26px;
  border-radius: 0 3px 3px 0;
  background: #e8e6df;
  content: "";
}

.chat-unread-dot {
  display: block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 1px solid #b2575c;
  border-radius: 50%;
  background: var(--unread);
  box-shadow: 0 0 0 2px #0e0e0e;
}

.chat-rail-button .chat-unread-dot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-color: #e0a4a7;
  box-shadow: 0 0 0 2px #080808;
}

.chat-rail-divider {
  width: 30px;
  height: 1px;
  margin: 2px 0;
  background: #2b2b2b;
}

.chat-rail-add,
.chat-rail-join {
  border-style: dashed;
  background: transparent;
}

.chat-navigation {
  position: relative;
  z-index: 5;
  display: grid;
  min-width: 0;
  grid-template-rows: 52px minmax(0, 1fr) 58px;
  border-right: 1px solid #272727;
  background: #0e0e0e;
}

.chat-navigation-header {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #242424;
}

.chat-navigation-title {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  padding: 8px 7px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: default;
  font-size: 12px;
  font-weight: 660;
  text-align: left;
}

.chat-navigation-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-navigation-title svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.chat-navigation-scroll {
  min-height: 0;
  padding: 10px 8px;
  overflow-y: auto;
}

.chat-search,
.chat-message-search {
  position: relative;
  display: block;
}

.chat-search {
  margin-bottom: 9px;
}

.chat-search svg,
.chat-message-search svg {
  position: absolute;
  top: 50%;
  left: 9px;
  z-index: 1;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--quiet);
  stroke-width: 1.7;
  pointer-events: none;
  transform: translateY(-50%);
}

.chat-search input,
.chat-message-search input {
  width: 100%;
  height: 34px;
  padding: 6px 9px 6px 30px;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  background: #090909;
  color: var(--ink-soft);
  font-size: 11px;
}

.chat-home-nav {
  display: grid;
  gap: 2px;
}

.chat-home-nav button,
.chat-conversation-row,
.chat-channel-row,
.chat-navigation-action {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 39px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #918f88;
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}

.chat-home-nav button:hover,
.chat-home-nav button.is-active,
.chat-conversation-row:hover,
.chat-conversation-row.is-active,
.chat-channel-row:hover,
.chat-channel-row.is-active,
.chat-navigation-action:hover {
  background: #1a1a1a;
  color: var(--ink);
}

.chat-navigation-danger {
  color: #b77a7d;
}

.chat-navigation-danger:hover {
  background: #1f1213;
  color: #e1a5a8;
}

.chat-home-nav svg,
.chat-channel-row svg,
.chat-navigation-action svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-home-nav span:not(.chat-nav-badge) {
  flex: 1;
  font-size: 11px;
  font-weight: 580;
}

.chat-nav-badge {
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #6d292d;
  color: #f2c4c4;
  font-size: 8px;
  text-align: center;
}

.chat-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 17px 5px 6px 9px;
  color: #62605b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.chat-list-heading button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--quiet);
  cursor: pointer;
  place-items: center;
}

.chat-list-heading button:hover {
  background: #1b1b1b;
  color: var(--ink);
}

.chat-list-heading svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.chat-conversation-list,
.chat-channel-list {
  display: grid;
  gap: 2px;
}

.chat-conversation-row {
  min-height: 46px;
}

.chat-conversation-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
}

.chat-conversation-row strong {
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  font-weight: 610;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-row small {
  overflow: hidden;
  color: var(--quiet);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-avatar,
.friend-avatar,
.chat-member-avatar,
.chat-message-avatar {
  display: grid;
  flex: 0 0 auto;
  border: 1px solid hsl(var(--avatar-hue) 10% 32%);
  border-radius: 50%;
  background: hsl(var(--avatar-hue) 8% 15%);
  color: #d8d6d0;
  font-weight: 680;
  place-items: center;
}

.chat-list-avatar {
  width: 30px;
  height: 30px;
  font-size: 9px;
}

.chat-list-avatar.is-group {
  border-radius: 9px;
}

.chat-account-bar {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 9px 11px;
  border-top: 1px solid #242424;
  background: #0b0b0b;
}

.chat-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  border: 1px solid #44423e;
  border-radius: 10px;
  background: #191919;
  color: var(--ink);
  font-size: 11px;
  font-weight: 720;
  place-items: center;
}

.chat-account-copy {
  display: grid;
  min-width: 0;
}

.chat-account-copy strong,
.chat-account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-account-copy strong {
  font-size: 10px;
}

.chat-account-copy small {
  color: var(--quiet);
  font-size: 9px;
}

.chat-account-bar > a {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--quiet);
  place-items: center;
}

.chat-account-bar > a:hover {
  background: #1b1b1b;
  color: var(--ink);
}

.chat-account-bar svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.chat-workspace {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 52px minmax(0, 1fr);
  background: #0b0b0b;
}

.chat-workspace-header {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid #272727;
  background: rgba(11, 11, 11, 0.96);
}

.chat-mobile-nav {
  display: none;
}

.chat-header-symbol {
  color: #76736c;
}

.chat-header-symbol svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.chat-header-copy {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

.chat-header-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-copy small {
  overflow: hidden;
  color: var(--quiet);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.chat-header-actions > button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  place-items: center;
}

.chat-header-actions > button:hover {
  background: #181818;
  color: var(--ink);
}

.chat-header-actions svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-message-search {
  width: min(30vw, 270px);
}

.chat-content {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 238px;
}

.friends-view,
.chat-messages-view {
  min-width: 0;
  min-height: 0;
}

.friends-view {
  overflow-y: auto;
  padding: 22px 28px;
}

.friends-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid #252525;
}

.friends-tabs {
  display: flex;
  gap: 3px;
}

.friends-tabs button {
  min-height: 31px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 620;
}

.friends-tabs button:hover,
.friends-tabs button.is-active {
  background: #1c1c1c;
  color: var(--ink);
}

.primary-compact-button {
  min-height: 31px;
  padding: 5px 11px;
  border: 1px solid #e4e2db;
  border-radius: 7px;
  background: #e4e2db;
  color: #111;
  cursor: pointer;
  font-size: 10px;
  font-weight: 660;
}

.friends-list {
  display: grid;
}

.friend-row {
  display: grid;
  min-height: 68px;
  align-items: center;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  border-bottom: 1px solid #222;
}

.friend-avatar {
  width: 36px;
  height: 36px;
  font-size: 10px;
}

.friend-row > span:nth-child(2) {
  display: grid;
}

.friend-row strong {
  font-size: 11px;
  font-weight: 630;
}

.friend-row small {
  color: var(--quiet);
  font-size: 9px;
}

.friend-actions {
  display: flex;
  gap: 5px;
}

.friend-action {
  min-height: 29px;
  padding: 5px 8px;
  border: 1px solid #303030;
  border-radius: 6px;
  background: #121212;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
}

.friend-action.primary {
  border-color: #d9d7d0;
  background: #d9d7d0;
  color: #111;
}

.friend-action.danger {
  border-color: #442a2c;
  color: #d79494;
}

.pending-label {
  color: var(--quiet);
  font-size: 9px;
}

.chat-empty-state,
.chat-loading-state {
  display: grid;
  min-height: 260px;
  align-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--quiet);
  text-align: center;
}

.chat-empty-state strong {
  color: var(--ink-soft);
  font-size: 14px;
}

.chat-empty-state p {
  max-width: 400px;
  margin: 6px 0 0;
  font-size: 11px;
}

.chat-messages-view {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.chat-load-older {
  width: fit-content;
  margin: 8px auto 0;
  padding: 5px 10px;
  border: 1px solid #2f2f2f;
  border-radius: 999px;
  background: #111;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
}

.chat-messages {
  min-height: 0;
  padding: 20px 16px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-message {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  margin: 1px -8px;
  padding: 7px 48px 7px 8px;
  border-radius: 7px;
}

.chat-message:hover {
  background: #101010;
}

.chat-message-avatar {
  width: 36px;
  height: 36px;
  margin-top: 1px;
  font-size: 9px;
}

.chat-message-content {
  min-width: 0;
}

.chat-message-content > header {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
}

.chat-message-content > header strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 660;
}

.chat-message-content > header span {
  color: #5f5d58;
  font-size: 9px;
}

.chat-message-content > header time {
  color: #5d5b55;
  font-size: 8px;
}

.chat-message-text {
  margin-top: 2px;
  color: #cfcdc7;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.chat-message-text a {
  color: #dedcd5;
  text-decoration-color: #66635d;
  text-underline-offset: 2px;
}

.chat-mention {
  padding: 1px 3px;
  border-radius: 4px;
  background: #292826;
  color: #f0eee7;
}

.chat-mention.is-unknown {
  background: #181818;
  color: var(--muted);
}

.chat-inline-emoji {
  width: 22px;
  height: 22px;
  margin: 0 2px;
  border-radius: 4px;
  object-fit: contain;
  vertical-align: middle;
}

.chat-message-reply-context {
  display: block;
  max-width: 100%;
  margin: 3px 0 2px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: #79766f;
  cursor: pointer;
  font-size: 9px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-message-deleted,
.chat-decryption-failure {
  margin: 3px 0 0;
  color: #77746d;
  font-size: 10px;
  font-style: italic;
}

.chat-decryption-failure {
  color: #bf8585;
}

.chat-message-actions {
  position: absolute;
  top: -11px;
  right: 8px;
  display: flex;
  padding: 2px;
  border: 1px solid #303030;
  border-radius: 7px;
  background: #151515;
  opacity: 0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.chat-message:hover .chat-message-actions,
.chat-message:focus-within .chat-message-actions {
  opacity: 1;
  transform: translateY(0);
}

.chat-message-actions button {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  place-items: center;
}

.chat-message-actions button:hover {
  background: #222;
  color: var(--ink);
}

.chat-message-actions svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.chat-reactions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 25px;
  padding: 2px 7px;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  background: #111;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.chat-reactions button img {
  width: 17px;
  height: 17px;
  border-radius: 3px;
  object-fit: contain;
}

.chat-reactions button.is-mine {
  border-color: #5a5852;
  background: #252422;
  color: var(--ink);
}

.chat-message-attachments {
  display: grid;
  max-width: 430px;
  gap: 6px;
  margin-top: 8px;
}

.chat-attachment-card {
  display: grid;
  min-height: 48px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  padding: 8px 10px;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  background: #101010;
}

.chat-attachment-card > span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 610;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-card small {
  grid-row: 2;
  color: var(--quiet);
  font-size: 8px;
}

.chat-attachment-card button {
  grid-row: 1 / span 2;
  grid-column: 2;
  padding: 5px 8px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #171717;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 9px;
}

.chat-attachment-card.is-error {
  border-color: #4b2d2f;
}

.chat-reply-bar {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  margin: 0 13px;
  padding: 5px 11px;
  border: 1px solid #2c2c2c;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #121212;
  color: var(--muted);
  font-size: 9px;
}

.chat-reply-bar strong {
  color: var(--ink-soft);
}

.chat-reply-bar button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  place-items: center;
}

.chat-reply-bar svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.chat-composer {
  position: relative;
  display: grid;
  min-height: 46px;
  align-items: end;
  grid-template-columns: 38px minmax(0, 1fr) 34px 38px;
  gap: 2px;
  margin: 0 13px 13px;
  padding: 4px;
  border: 1px solid #303030;
  border-radius: 9px;
  background: #151515;
}

.chat-composer:focus-within {
  border-color: #484742;
}

.chat-composer textarea {
  width: 100%;
  min-height: 36px;
  max-height: 180px;
  padding: 8px 6px;
  resize: none;
  overflow-y: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.chat-composer textarea:focus {
  box-shadow: none;
}

.chat-upload-button,
.chat-emoji-button,
.chat-send-button {
  display: grid;
  width: 34px;
  height: 34px;
  align-self: end;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  place-items: center;
}

.chat-upload-button:hover,
.chat-emoji-button:hover {
  background: #202020;
  color: var(--ink);
}

.chat-send-button {
  background: #e4e2db;
  color: #101010;
}

.chat-upload-button svg,
.chat-emoji-button svg,
.chat-send-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-file-preview {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 7px 3px;
  border-top: 1px solid #282828;
}

.chat-file-preview span {
  padding: 3px 6px;
  border: 1px solid #303030;
  border-radius: 5px;
  color: var(--muted);
  font-size: 8px;
}

.chat-file-preview span.is-error {
  border-color: #512f32;
  color: #d79797;
}

.chat-composer-status {
  grid-column: 1 / -1;
  margin: 0;
  padding: 3px 7px 5px;
  color: var(--muted);
  font-size: 9px;
}

.chat-members {
  min-width: 0;
  padding: 17px 10px;
  overflow-y: auto;
  border-left: 1px solid #272727;
  background: #0d0d0d;
  transition: width 180ms var(--ease-out), opacity 150ms ease;
}

.chat-members.is-hidden {
  display: none;
}

.chat-members.is-placeholder {
  opacity: 0.45;
}

.chat-member-heading {
  margin: 0 7px 9px;
  color: #62605b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-member-list {
  display: grid;
  gap: 2px;
}

.chat-member-row {
  display: grid;
  min-height: 42px;
  align-items: center;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
}

.chat-member-row:hover {
  background: #181818;
}

.chat-member-avatar {
  width: 28px;
  height: 28px;
  font-size: 8px;
}

.chat-member-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.chat-member-row strong,
.chat-member-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-member-row strong {
  color: #bdbab3;
  font-size: 10px;
  font-weight: 600;
}

.chat-member-row small {
  color: #5f5d58;
  font-size: 8px;
}

.member-manage-button {
  min-height: 25px;
  padding: 3px 6px;
  opacity: 0;
  font-size: 8px;
}

.chat-member-row:hover .member-manage-button,
.chat-member-row:focus-within .member-manage-button {
  opacity: 1;
}

.chat-mobile-scrim {
  display: none;
}

.app-dialog-wide {
  width: min(calc(100% - 32px), 760px);
}

.dialog-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.dialog-card h2 {
  margin-top: 3px;
  font-size: 21px;
}

.dialog-card > p {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 11px;
}

.dialog-card > label,
.server-tools-grid form > label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 620;
}

.dialog-card label small {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 500;
}

.dialog-card > footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.dialog-close {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  place-items: center;
}

.dialog-close:hover {
  background: #1b1b1b;
  color: var(--ink);
}

.dialog-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.dialog-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.server-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.server-tools-grid form {
  min-width: 0;
}

.server-tools-grid h3 {
  margin: 0 0 12px;
  font-size: 13px;
}

.permission-grid {
  display: grid;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.permission-grid legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 9px;
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.permission-grid input {
  width: 14px;
  height: 14px;
  accent-color: #e4e2db;
}

.private-role-options {
  margin: 4px 0 0;
  padding: 12px;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
}

.private-role-options legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 9px;
}

.private-role-options > div {
  display: grid;
  gap: 7px;
}

.private-role-options .check-row {
  margin: 0;
}

.private-role-empty {
  margin: 0;
  color: var(--quiet);
  font-size: 9px;
  line-height: 1.5;
}

.result-copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.group-manager {
  display: grid;
  gap: 10px;
}

.group-manager > h3 {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.group-add-form {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.group-manager-row {
  display: grid;
  min-height: 50px;
  align-items: center;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #242424;
}

.group-manager-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.group-manager-row strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.group-manager-row small {
  color: var(--quiet);
  font-size: 9px;
}

.image-preview-dialog {
  width: min(calc(100% - 32px), 960px);
}

.image-preview-dialog [data-result-body] {
  display: grid;
  max-height: 70vh;
  place-items: center;
}

.image-preview-dialog img {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 8px;
  object-fit: contain;
}

.emoji-popover {
  position: fixed;
  z-index: 80;
  display: grid;
  width: 300px;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  padding: 8px;
  border: 1px solid #383838;
  border-radius: 10px;
  background: #131313;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.62);
}

.emoji-popover button {
  display: grid;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  place-items: center;
}

.emoji-popover button:hover {
  background: #242424;
}

.emoji-popover img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.emoji-popover input {
  height: 34px;
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .chat-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-members {
    position: absolute;
    z-index: 9;
    top: 52px;
    right: 0;
    width: 238px;
    height: calc(100% - 52px);
    box-shadow: -20px 0 55px rgba(0, 0, 0, 0.36);
  }

  .chat-members.is-hidden {
    display: none;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto auto minmax(160px, 1fr) auto;
    gap: 10px;
  }

  .product-switcher a span {
    display: none;
  }

  .product-switcher a {
    padding: 6px 8px;
  }

  .chat-shell {
    grid-template-columns: 64px 238px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .chat-shell {
    position: relative;
    height: calc(100vh - 62px);
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .chat-server-rail {
    z-index: 21;
  }

  .chat-navigation {
    position: fixed;
    z-index: 35;
    top: 62px;
    left: 58px;
    width: min(82vw, 270px);
    height: calc(100vh - 62px);
    box-shadow: 24px 0 70px rgba(0, 0, 0, 0.56);
    transform: translateX(calc(-100% - 60px));
    transition: transform 200ms var(--ease-out);
  }

  .chat-navigation.is-mobile-open {
    transform: translateX(0);
  }

  .chat-mobile-scrim {
    position: fixed;
    z-index: 34;
    inset: 62px 0 0 58px;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
  }

  body.chat-nav-open {
    overflow: hidden;
  }

  body.chat-nav-open .chat-mobile-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-mobile-nav {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    place-items: center;
  }

  .chat-mobile-nav svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }

  .chat-header-copy small {
    display: none;
  }

  .chat-message-search {
    width: min(34vw, 210px);
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  .chat-mailbox-switcher {
    display: none;
  }

  .settings-inline-control,
  .recovery-unlock-form,
  .privacy-rows > div,
  .contact-form,
  .contact-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .security-callout {
    display: grid;
  }

  .security-state-badge {
    max-width: 180px;
  }

  .server-tools-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .topbar-actions .notification-button {
    display: none;
  }

  .topbar-actions {
    grid-column: 3;
    justify-self: end;
  }

  .mailbox-switcher {
    display: none;
  }

  .chat-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-server-rail {
    position: fixed;
    z-index: 22;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: 58px;
    align-items: center;
    flex-direction: row;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid #282828;
    border-right: 0;
    background: rgba(8, 8, 8, 0.97);
    backdrop-filter: blur(18px);
  }

  .chat-rail-button {
    width: 40px;
    height: 40px;
  }

  .chat-rail-divider {
    width: 1px;
    height: 28px;
    flex: 0 0 auto;
  }

  .chat-navigation {
    left: 0;
    height: calc(100vh - 120px);
  }

  .chat-mobile-scrim {
    inset: 62px 0 58px;
  }

  .chat-workspace {
    padding-bottom: 58px;
  }

  .chat-workspace-header {
    padding: 0 10px;
  }

  .chat-header-symbol {
    display: none;
  }

  .chat-message-search {
    width: 112px;
  }

  .chat-message-search input {
    padding-right: 6px;
    font-size: 9px;
  }

  .friends-view {
    padding: 15px 13px;
  }

  .friends-toolbar {
    align-items: flex-start;
  }

  .friend-row {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 9px 0;
  }

  .friend-actions {
    grid-column: 2;
    flex-wrap: wrap;
  }

  .chat-messages {
    padding-right: 8px;
    padding-left: 8px;
  }

  .chat-message {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
    padding-right: 10px;
  }

  .chat-message-avatar {
    width: 30px;
    height: 30px;
  }

  .chat-message-actions {
    position: static;
    grid-column: 2;
    width: fit-content;
    margin-top: 5px;
    opacity: 1;
    box-shadow: none;
    transform: none;
  }

  .chat-composer {
    margin-right: 8px;
    margin-left: 8px;
    grid-template-columns: 34px minmax(0, 1fr) 34px 36px;
  }

  .chat-members {
    top: 52px;
    width: min(78vw, 260px);
    height: calc(100% - 110px);
  }

  .delivery-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  .delivery-mode label > span {
    min-height: 50px;
  }

  .security-device-row,
  .security-session-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .security-device-row > button,
  .security-session-row > button {
    width: fit-content;
    grid-column: 2;
  }

  .permission-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}
