:root {
  color-scheme: light;
  --ink: #07131f;
  --ink-2: #1b3046;
  --muted: #526579;
  --line: rgba(7, 19, 31, 0.16);
  --soft-line: rgba(255, 255, 255, 0.82);
  --page: #eef3f1;
  --panel: rgba(255, 255, 255, 0.94);
  --white: #ffffff;
  --accent: #007f99;
  --accent-2: #00a0b7;
  --midnight: #07131f;
  --pine: #145f47;
  --moss: #748c3f;
  --sun: #b98527;
  --rose: #a64150;
  --sky: #a9edff;
  --font-ui: "Manrope", "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --shadow: 0 26px 76px rgba(7, 19, 31, 0.2);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(0, 127, 153, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(185, 133, 39, 0.16), transparent 30%),
    var(--page);
  font-family: var(--font-ui);
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr) 360px;
  min-height: 100vh;
  padding: 14px;
  gap: 14px;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(0, 127, 153, 0.2), transparent 36%),
    linear-gradient(315deg, rgba(185, 133, 39, 0.18), transparent 32%),
    linear-gradient(180deg, #07131f, #0c2532 58%, #eef3f1 58%);
}

.auth-card {
  width: min(520px, 100%);
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.auth-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.65rem;
  line-height: 1;
}

.auth-brand p,
.auth-note {
  margin: 5px 0 0;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-tabs button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 850;
}

.auth-tabs button.is-active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 10px 26px rgba(7, 19, 31, 0.1);
}

.auth-form {
  display: grid;
  gap: 14px;
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.auth-form input,
.auth-form select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 8px;
  font: inherit;
}

.organization-field {
  display: grid;
  gap: 7px;
}

.organization-field > label {
  display: block;
}

.organization-picker {
  position: relative;
}

.organization-picker > input[type="search"] {
  padding-right: 38px;
}

.organization-picker > input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.organization-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 272px;
  overflow-y: auto;
  padding: 6px;
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(7, 19, 31, 0.18);
}

.organization-result {
  display: grid;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.organization-result:hover,
.organization-result:focus-visible {
  background: rgba(0, 127, 153, 0.1);
  outline: none;
}

.organization-result strong,
.organization-result span {
  overflow-wrap: anywhere;
}

.organization-result strong {
  font-size: 0.84rem;
}

.organization-result span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.organization-empty {
  margin: 0;
  padding: 12px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.organization-not-listed {
  justify-self: start;
  padding: 0;
  color: #006c82;
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-weight: 850;
}

.organization-not-listed:hover {
  color: #004b5b;
}

.signup-org-create {
  padding: 12px;
  background: rgba(0, 127, 153, 0.08);
  border: 1px solid rgba(0, 127, 153, 0.2);
  border-radius: 8px;
}

.organization-directory-note {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.45;
}

.auth-note {
  font-size: 0.86rem;
}

.rail,
.messenger,
.context-panel,
.install-banner {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.rail {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: calc(100vh - 28px);
  padding: 18px;
  overflow-y: auto;
  color: rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(180deg, rgba(7, 19, 31, 0.88), rgba(7, 19, 31, 0.97)),
    url("https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1100&q=82") center / cover;
}

.brand,
.brand-lockup,
.me-card,
.nav-heading,
.conversation-button,
.member-row,
.chat-header,
.header-actions,
.composer-main,
.composer-shortcuts,
.mobile-tabbar,
.message-actions,
.file-chip,
.install-banner,
.reaction-row {
  display: flex;
  align-items: center;
}

.brand {
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  min-width: 0;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.34), transparent 26%),
    linear-gradient(145deg, #07131f 0%, #0b5261 58%, #b98527 145%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 18px 34px rgba(0, 0, 0, 0.28);
}

.brand-mark span {
  position: absolute;
  width: 25px;
  height: 25px;
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-left: 0;
  border-radius: 0 50% 50% 0;
  transform: translateX(2px);
}

.brand-mark::before {
  position: absolute;
  left: 14px;
  top: 13px;
  width: 4px;
  height: 27px;
  content: "";
  background: linear-gradient(180deg, #ffffff, #a9edff);
  border-radius: 4px;
}

.brand-mark::after {
  position: absolute;
  right: 11px;
  bottom: 11px;
  width: 10px;
  height: 10px;
  content: "";
  background: var(--sun);
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: -15px -15px 0 -3px var(--accent-2);
}

.brand strong,
.me-card strong {
  display: block;
  color: var(--white);
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1.22rem;
  line-height: 1;
}

.brand small,
.me-card p {
  display: block;
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}

.ghost-icon,
.icon-action,
.composer-icon,
.menu-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: inherit;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
}

.rail-close {
  display: none;
}

.me-card {
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}

.org-switcher {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
}

.org-switcher label {
  display: grid;
  gap: 7px;
}

.org-switcher label span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.org-switcher select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  color: var(--white);
  background: rgba(7, 19, 31, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
}

.org-switcher option {
  color: var(--ink);
  background: var(--white);
}

.org-scope {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.org-scope strong {
  display: block;
  color: var(--white);
}

.org-scope p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.84rem;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  color: var(--ink);
  background: var(--white);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 850;
}

.avatar img,
.conversation-glyph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.active {
  box-shadow: 0 0 0 4px rgba(124, 224, 166, 0.16);
}

.profile-photo-button {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 2px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.profile-photo-edit {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 18px;
  height: 18px;
  color: #07131f;
  background: #bfefff;
  border: 2px solid #173345;
  border-radius: 50%;
}

.profile-photo-edit::before {
  position: absolute;
  inset: 5px 3px 3px;
  content: "";
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.profile-photo-edit::after {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 3px;
  height: 3px;
  content: "";
  border: 1px solid currentColor;
  border-radius: 50%;
}

.profile-photo-button:hover .avatar,
.profile-photo-button:focus-visible .avatar {
  box-shadow: 0 0 0 4px rgba(191, 245, 255, 0.28);
}

.profile-photo-button.is-uploading .avatar {
  opacity: 0.58;
}

.presence-pill {
  margin-left: auto;
  min-height: 32px;
  padding: 0 10px;
  color: #083527;
  background: #8ee3ad;
  border: 0;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
}

.presence-pill.is-away {
  color: #3d2a06;
  background: #f1cf79;
}

.global-search,
.message-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.global-search {
  background: rgba(255, 255, 255, 0.17);
  border-color: rgba(255, 255, 255, 0.26);
}

.global-search input {
  color: var(--white);
}

.global-search input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.global-search span,
.message-search span {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0.72;
}

.global-search span::after,
.message-search span::after {
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  content: "";
  background: currentColor;
  transform: rotate(45deg);
}

input,
textarea {
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.nav-section + .nav-section {
  margin-top: 20px;
}

.nav-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-heading .ghost-icon {
  width: 30px;
  height: 30px;
  font-size: 1.15rem;
}

.conversation-list {
  display: grid;
  gap: 8px;
}

.conversation-button {
  width: 100%;
  min-height: 64px;
  gap: 10px;
  padding: 10px;
  color: rgba(255, 255, 255, 0.88);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.conversation-button.is-active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.34);
}

.conversation-glyph {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: var(--sky);
  border-radius: 8px;
  font-weight: 900;
}

.conversation-glyph.has-photo {
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border-radius: 50%;
}

.conversation-copy {
  min-width: 0;
  flex: 1;
}

.conversation-copy strong,
.conversation-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-copy span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
}

.unread-badge {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  color: var(--ink);
  background: var(--white);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
}

.compact .conversation-button {
  min-height: 54px;
}

.compact .conversation-glyph {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.rail-footer {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: auto;
}

.rail-footer button,
.composer-shortcuts button,
.secondary-action,
.primary-action {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 800;
}

.rail-footer button {
  color: var(--white);
  background: rgba(255, 255, 255, 0.17);
  border: 1px solid rgba(255, 255, 255, 0.26);
  font-size: 0.78rem;
}

.rail-footer .admin-return-action {
  grid-column: 1 / -1;
  color: #07131f;
  background: #bfefff;
  border-color: #bfefff;
}

.messenger {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  max-height: calc(100vh - 28px);
  overflow: hidden;
  background: var(--panel);
}

.chat-header {
  gap: 16px;
  min-height: 92px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.menu-button {
  display: none;
  flex: 0 0 auto;
  color: var(--white);
  background: var(--midnight);
  border-color: transparent;
}

.menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.chat-title {
  min-width: 0;
  flex: 1;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.05;
}

.chat-title p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.header-actions {
  gap: 8px;
}

.icon-action,
.composer-icon {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line);
}

.icon-action.is-active {
  color: var(--white);
  background: var(--accent);
}

.icon-bell,
.icon-phone,
.icon-info,
.icon-plus,
.icon-wave {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.icon-bell::before {
  position: absolute;
  inset: 2px 4px 5px;
  content: "";
  border: 2px solid currentColor;
  border-bottom-width: 3px;
  border-radius: 8px 8px 4px 4px;
}

.icon-bell::after {
  position: absolute;
  bottom: 1px;
  left: 7px;
  width: 4px;
  height: 4px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

.icon-phone::before {
  position: absolute;
  inset: 3px;
  content: "";
  border: 3px solid currentColor;
  border-top-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(24deg);
}

.icon-info::before {
  position: absolute;
  inset: 1px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-info::after {
  position: absolute;
  left: 8px;
  top: 5px;
  width: 2px;
  height: 9px;
  content: "";
  background: currentColor;
  box-shadow: 0 -4px 0 currentColor;
}

.icon-plus::before,
.icon-plus::after {
  position: absolute;
  left: 8px;
  top: 3px;
  width: 2px;
  height: 12px;
  content: "";
  background: currentColor;
}

.icon-plus::after {
  transform: rotate(90deg);
}

.icon-wave::before {
  position: absolute;
  inset: 3px 1px;
  content: "";
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 50%;
}

.icon-wave::after {
  position: absolute;
  left: 8px;
  top: 2px;
  width: 2px;
  height: 14px;
  content: "";
  background: currentColor;
  border-radius: 2px;
}

.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.segmented-control {
  display: flex;
  padding: 4px;
  background: rgba(16, 29, 43, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 800;
}

.segmented-control button.is-active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 8px 24px rgba(16, 29, 43, 0.08);
}

.message-search {
  width: 260px;
  color: var(--muted);
  background: var(--white);
  border-color: rgba(7, 19, 31, 0.2);
}

.message-search input {
  width: 100%;
}

.message-surface {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 20px;
  scroll-behavior: smooth;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.date-divider::before,
.date-divider::after {
  flex: 1;
  height: 1px;
  content: "";
  background: var(--line);
}

.message-list {
  display: grid;
  gap: 18px;
}

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

.message.is-mine {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.message.is-mine .avatar {
  grid-column: 2;
}

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

.message.is-mine .message-content {
  grid-column: 1;
  justify-self: end;
}

.message-bubble {
  width: min(720px, 100%);
  padding: 14px 15px;
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 8px;
  box-shadow: 0 16px 44px rgba(7, 19, 31, 0.09);
}

.message.is-mine .message-bubble {
  color: var(--white);
  background: linear-gradient(135deg, var(--midnight), var(--accent));
  border-color: rgba(255, 255, 255, 0.12);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #4b5f73;
  font-size: 0.8rem;
}

.message.is-mine .message-meta,
.message.is-mine .message-text,
.message.is-mine .message-note {
  color: rgba(255, 255, 255, 0.82);
}

.message-text {
  margin: 8px 0 0;
  color: var(--ink);
}

.message-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.message-actions {
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

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

.message-actions button,
.reaction-row button {
  min-height: 30px;
  padding: 0 9px;
  color: #40566c;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.message-actions .danger-action {
  color: var(--rose);
  border-color: rgba(166, 65, 80, 0.28);
}

.message.is-mine .message-actions button {
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.message.is-mine .message-actions .danger-action {
  color: var(--white);
}

.reaction-row {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.reaction-row button {
  min-height: 28px;
}

.reaction-row button.is-active {
  color: var(--white);
  background: var(--accent);
  border-color: transparent;
}

.reaction-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  padding: 7px;
  background: rgba(238, 243, 241, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reaction-picker button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 1.05rem;
}

.attachments {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.media-attachment {
  display: grid;
  gap: 7px;
  width: min(100%, 360px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.media-attachment img,
.inline-gif img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #07131f;
}

.media-attachment span {
  padding: 0 10px 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.inline-gif {
  display: block;
  width: min(100%, 360px);
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-chip {
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.attachments button.file-chip:hover,
.mini-item button[data-download-attachment]:hover {
  border-color: var(--accent);
}

.mini-item button[data-download-attachment] {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.composer-icon.is-active {
  color: var(--white);
  background: var(--rose);
  border-color: var(--rose);
}

.message.is-mine .file-chip {
  color: var(--white);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--white);
  background: var(--sun);
  border-radius: 7px;
  font-size: 0.68rem;
  font-weight: 900;
}

.typing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.typing-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--white);
  background: var(--pine);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 850;
}

.typing-bubble {
  display: flex;
  gap: 5px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.typing-bubble span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing 900ms infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes typing {
  0%, 100% {
    opacity: 0.28;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  text-align: center;
}

.composer {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(238, 243, 241, 0.96);
}

.attachment-tray {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.attachment-tray .file-chip {
  background: var(--white);
}

.gif-tray {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-bottom: 10px;
}

.gif-tray input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.composer-gif {
  width: 46px;
  font-size: 0.67rem;
  font-weight: 950;
}

.attachment-remove {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
}

.composer-main {
  gap: 8px;
}

.composer-input {
  flex: 1;
  min-width: 0;
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 150px;
  min-height: 46px;
  padding: 12px 14px;
  resize: none;
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.2);
  border-radius: 8px;
}

.send-button,
.primary-action {
  min-height: 44px;
  padding: 0 18px;
  color: var(--white);
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.composer-shortcuts {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.composer-shortcuts button,
.secondary-action {
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
}

.context-panel {
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  padding: 18px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.9);
}

.panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h2 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: 1.36rem;
  font-weight: 800;
  line-height: 1.12;
}

h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
  line-height: 1.18;
}

.panel-card,
.metric-card {
  padding: 16px;
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.16);
  border-radius: 8px;
}

.workspace-widget-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.view-widget {
  padding: 15px;
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.16);
  border-radius: 8px;
}

.view-widget-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.view-widget-heading span {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.view-widget-heading strong {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.view-widget b {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.05;
}

.view-widget p {
  margin: 6px 0 0;
  color: var(--muted);
}

.view-widget .note-value {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}

.access-form,
.widget-form {
  display: grid;
  gap: 10px;
}

.access-form > label,
.widget-form > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.access-form select,
.widget-form select,
.widget-form input,
.permission-controls select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.access-member-list,
.role-manager-list,
.widget-manager-list {
  display: grid;
  gap: 8px;
}

.access-member {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 9px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.access-member input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.access-member strong,
.access-member small {
  display: block;
}

.access-member small {
  color: var(--muted);
}

.permission-row,
.widget-manager-row {
  display: grid;
  gap: 9px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.permission-row:first-child,
.widget-manager-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.permission-person {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.permission-person .avatar {
  width: 34px;
  height: 34px;
  font-size: 0.68rem;
}

.permission-person p,
.widget-manager-row p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.permission-fixed {
  width: fit-content;
  padding: 4px 7px;
  color: var(--pine);
  background: rgba(20, 95, 71, 0.1);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 900;
}

.permission-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 7px;
}

.permission-controls button {
  min-height: 40px;
}

.widget-form {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.widget-form-actions,
.widget-manager-row > div:last-child,
.admin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.widget-manager-list {
  margin-top: 12px;
}

.widget-manager-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.widget-manager-row button {
  min-height: 32px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 850;
}

.widget-manager-row .danger-action {
  color: var(--rose);
}

.admin-detail-actions {
  margin-top: 14px;
}

.manager-dashboard.is-disabled {
  opacity: 0.72;
}

.manager-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.policy-note {
  padding: 12px;
  background: var(--page);
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 8px;
}

.policy-note strong {
  display: block;
  margin-bottom: 4px;
}

.policy-note p {
  margin-bottom: 0;
}

.panel-card + .panel-card,
.metric-card + .panel-card {
  margin-top: 12px;
}

.metric-card span,
.metric-card p,
.panel-card p {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 2.3rem;
  line-height: 1;
}

.metric-card p {
  margin-bottom: 0;
}

.meter-track {
  height: 10px;
  margin-top: 16px;
  overflow: hidden;
  background: #e3e9e5;
  border-radius: 999px;
}

.meter-track span {
  display: block;
  width: 68%;
  height: 100%;
  background: linear-gradient(90deg, var(--pine), var(--accent), var(--sun));
}

.panel-heading {
  margin-bottom: 12px;
}

.mini-list,
.member-stack {
  display: grid;
  gap: 9px;
}

.mini-item {
  padding: 11px;
  background: var(--page);
  border: 1px solid rgba(7, 19, 31, 0.15);
  border-radius: 8px;
}

.audit-item {
  padding: 0;
  overflow: hidden;
}

.audit-item button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.audit-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.approval-item {
  display: grid;
  gap: 12px;
}

.approval-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary-action.danger-action {
  color: var(--rose);
  border-color: rgba(166, 65, 80, 0.28);
}

.mini-item strong {
  display: block;
  margin-bottom: 4px;
}

.mini-item p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.member-row {
  gap: 10px;
}

.member-row .avatar {
  width: 34px;
  height: 34px;
  font-size: 0.72rem;
}

.member-row p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.thread-preview {
  padding: 12px;
  color: var(--muted);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
}

.thread-reply {
  display: block;
  margin: 10px 0;
  padding: 0 12px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.thread-reply input {
  width: 100%;
  min-height: 42px;
}

.install-card p {
  margin-bottom: 0;
}

.superadmin-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
  color: #f6fbfd;
  background:
    linear-gradient(135deg, rgba(0, 160, 183, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(185, 133, 39, 0.16), transparent 30%),
    #08121b;
}

.superadmin-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 22px;
  overflow-y: auto;
  background: rgba(5, 12, 18, 0.88);
  border-right: 1px solid rgba(216, 235, 243, 0.14);
}

.superadmin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.superadmin-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1;
}

.superadmin-brand p,
.admin-search span,
.admin-org-button span,
.admin-status,
.admin-card-header span,
.admin-metric p,
.admin-message-row p,
.admin-user-row p,
.admin-activity-item p {
  color: #b9cad4;
}

.admin-search {
  display: grid;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-search input,
.admin-inline-search input,
.admin-form-grid input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: #f6fbfd;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(216, 235, 243, 0.16);
  border-radius: 8px;
  font: inherit;
}

.admin-search input::placeholder,
.admin-inline-search input::placeholder {
  color: #89a2af;
}

.admin-org-list,
.admin-approval-list,
.admin-message-audit,
.admin-user-table,
.admin-activity-list {
  display: grid;
  gap: 10px;
}

.admin-org-button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 13px;
  color: #f6fbfd;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(216, 235, 243, 0.12);
  border-radius: 8px;
  text-align: left;
}

.admin-org-button.is-active {
  background: linear-gradient(135deg, rgba(0, 160, 183, 0.32), rgba(185, 133, 39, 0.18));
  border-color: rgba(191, 239, 255, 0.42);
}

.admin-org-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.superadmin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: auto;
}

.superadmin-actions button {
  min-height: 42px;
  color: #f6fbfd;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(216, 235, 243, 0.18);
  border-radius: 8px;
  font-weight: 850;
}

.superadmin-main {
  display: grid;
  gap: 18px;
  padding: 24px;
  overflow-x: hidden;
}

.superadmin-header,
.admin-card-header,
.admin-message-row,
.admin-user-row,
.admin-activity-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.superadmin-header {
  padding: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(216, 235, 243, 0.16);
  border-radius: 8px;
}

.superadmin-header h1 {
  color: #ffffff;
  font-size: 3.4rem;
}

.superadmin-header p:last-child {
  max-width: 780px;
  margin-bottom: 0;
  color: #d8ebf3;
}

.admin-status {
  display: grid;
  gap: 5px;
  min-width: 170px;
  padding: 12px;
  background: rgba(191, 239, 255, 0.1);
  border: 1px solid rgba(191, 239, 255, 0.22);
  border-radius: 8px;
  text-align: right;
}

.admin-profile-photo {
  justify-self: end;
}

.admin-status strong {
  color: #bfefff;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-stat-grid article,
.admin-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

.admin-stat-grid article {
  padding: 16px;
  color: var(--ink);
}

.admin-stat-grid span,
.admin-card .eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-stat-grid strong {
  display: block;
  margin: 6px 0 3px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
}

.admin-stat-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.admin-card {
  min-width: 0;
  padding: 18px;
  color: var(--ink);
}

.admin-message-card {
  grid-row: span 2;
}

.admin-card h2 {
  color: var(--ink);
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.admin-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.admin-form-grid input,
.admin-inline-search input {
  color: var(--ink);
  background: var(--white);
  border-color: rgba(7, 19, 31, 0.18);
}

.admin-org-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.admin-metric {
  padding: 11px;
  background: var(--page);
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 8px;
}

.admin-metric strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1.25rem;
}

.admin-metric p {
  margin-bottom: 0;
  font-size: 0.78rem;
}

.admin-request-item,
.admin-message-row,
.admin-user-row,
.admin-activity-item {
  padding: 12px;
  background: var(--page);
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 8px;
}

.admin-request-item {
  display: grid;
  gap: 12px;
}

.admin-request-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-message-row {
  align-items: stretch;
}

.admin-message-row strong,
.admin-user-row strong,
.admin-activity-item strong {
  display: block;
  margin-bottom: 4px;
}

.admin-message-row p,
.admin-user-row p,
.admin-activity-item p {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.admin-message-meta,
.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.admin-inline-search {
  width: min(330px, 100%);
}

.admin-message-actions {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 140px;
}

.admin-message-actions button {
  min-height: 34px;
}

.install-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  gap: 14px;
  max-width: min(460px, calc(100% - 36px));
  padding: 14px;
  background: var(--white);
}

.install-banner p {
  margin: 2px 0 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  max-width: min(440px, calc(100% - 32px));
  padding: 12px 14px;
  color: var(--white);
  background: rgba(16, 29, 43, 0.94);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.mobile-tabbar {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f7fbff;
  --ink-2: #dbe8ef;
  --muted: #b9cad4;
  --line: rgba(218, 238, 247, 0.2);
  --soft-line: rgba(255, 255, 255, 0.18);
  --page: #071018;
  --panel: rgba(11, 24, 36, 0.96);
  --white: #14283a;
  --accent: #35c6df;
  --sky: #bff5ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body,
[data-theme="dark"] .composer {
  background: #071018;
}

[data-theme="dark"] .avatar {
  color: #07131f;
  background: #dceff3;
}

[data-theme="dark"] .send-button,
[data-theme="dark"] .primary-action {
  color: #07131f;
  background: #bfefff;
}

[data-theme="dark"] .messenger,
[data-theme="dark"] .context-panel,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .install-banner {
  color: var(--ink);
  background: rgba(11, 24, 36, 0.96);
  border-color: rgba(218, 238, 247, 0.18);
}

[data-theme="dark"] .auth-screen {
  background:
    linear-gradient(135deg, rgba(53, 198, 223, 0.18), transparent 36%),
    linear-gradient(315deg, rgba(185, 133, 39, 0.18), transparent 32%),
    #071018;
}

[data-theme="dark"] .auth-brand p,
[data-theme="dark"] .auth-note,
[data-theme="dark"] .organization-directory-note,
[data-theme="dark"] .chat-title p:last-child,
[data-theme="dark"] .date-divider,
[data-theme="dark"] .panel-card p,
[data-theme="dark"] .metric-card p,
[data-theme="dark"] .metric-card span,
[data-theme="dark"] .member-row p,
[data-theme="dark"] .mini-item p,
[data-theme="dark"] .thread-preview {
  color: var(--muted);
}

[data-theme="dark"] .auth-tabs,
[data-theme="dark"] .segmented-control,
[data-theme="dark"] .policy-note,
[data-theme="dark"] .mini-item,
[data-theme="dark"] .thread-preview,
[data-theme="dark"] .thread-reply {
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.16);
}

[data-theme="dark"] .auth-tabs button,
[data-theme="dark"] .segmented-control button {
  color: #b9cad4;
}

[data-theme="dark"] .auth-tabs button.is-active,
[data-theme="dark"] .segmented-control button.is-active {
  color: #07131f;
  background: #bfefff;
}

[data-theme="dark"] .auth-form label {
  color: var(--ink);
}

[data-theme="dark"] .auth-form input,
[data-theme="dark"] .auth-form select,
[data-theme="dark"] .message-search,
[data-theme="dark"] .composer textarea,
[data-theme="dark"] .thread-reply input {
  color: var(--ink);
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.22);
}

[data-theme="dark"] .signup-org-create {
  background: rgba(53, 198, 223, 0.12);
  border-color: rgba(191, 239, 255, 0.22);
}

[data-theme="dark"] .organization-results {
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.22);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .organization-result {
  color: var(--ink);
}

[data-theme="dark"] .organization-result:hover,
[data-theme="dark"] .organization-result:focus-visible {
  background: rgba(53, 198, 223, 0.16);
}

[data-theme="dark"] .organization-not-listed {
  color: #8fe8f8;
}

[data-theme="dark"] .organization-not-listed:hover {
  color: #d5f8ff;
}

[data-theme="dark"] .auth-form input::placeholder,
[data-theme="dark"] .message-search input::placeholder,
[data-theme="dark"] .composer textarea::placeholder {
  color: #8ba2ae;
}

[data-theme="dark"] .icon-action,
[data-theme="dark"] .composer-icon,
[data-theme="dark"] .secondary-action,
[data-theme="dark"] .composer-shortcuts button,
[data-theme="dark"] .quick-actions button {
  color: var(--ink);
  background: #102235;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .message-bubble,
[data-theme="dark"] .panel-card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .view-widget,
[data-theme="dark"] .typing-bubble {
  color: var(--ink);
  background: #102235;
  border-color: rgba(218, 238, 247, 0.18);
}

[data-theme="dark"] .message-text,
[data-theme="dark"] .message-meta strong,
[data-theme="dark"] .mini-item strong,
[data-theme="dark"] .panel-card strong,
[data-theme="dark"] .metric-card strong,
[data-theme="dark"] .view-widget b,
[data-theme="dark"] .view-widget .note-value,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
  color: var(--ink);
}

[data-theme="dark"] .message-meta,
[data-theme="dark"] .message-note,
[data-theme="dark"] .audit-item span {
  color: #b9cad4;
}

[data-theme="dark"] .message-actions button,
[data-theme="dark"] .reaction-row button {
  color: var(--ink);
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .reaction-picker,
[data-theme="dark"] .access-member {
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .reaction-picker button {
  background: #14283a;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .message.is-mine .message-bubble {
  color: #ffffff;
  background: linear-gradient(135deg, #063c4a, #007f99);
}

[data-theme="dark"] .message.is-mine .message-meta,
[data-theme="dark"] .message.is-mine .message-text,
[data-theme="dark"] .message.is-mine .message-note {
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .file-chip,
[data-theme="dark"] .attachment-tray .file-chip,
[data-theme="dark"] .media-attachment {
  color: var(--ink);
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .gif-tray input,
[data-theme="dark"] .access-form select,
[data-theme="dark"] .widget-form select,
[data-theme="dark"] .widget-form input,
[data-theme="dark"] .permission-controls select {
  color: var(--ink);
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.22);
}

[data-theme="dark"] .view-widget p,
[data-theme="dark"] .view-widget-heading strong,
[data-theme="dark"] .access-form > label,
[data-theme="dark"] .widget-form > label,
[data-theme="dark"] .access-member small,
[data-theme="dark"] .permission-person p,
[data-theme="dark"] .widget-manager-row p,
[data-theme="dark"] .media-attachment span {
  color: #d4e7ef;
}

[data-theme="dark"] .permission-fixed {
  color: #bfefff;
  background: rgba(53, 198, 223, 0.14);
}

[data-theme="dark"] .widget-manager-row button {
  color: var(--ink);
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .toast {
  color: #07131f;
  background: #bfefff;
}

[data-theme="dark"] .rail {
  color: #f8fdff;
  background:
    linear-gradient(180deg, rgba(3, 9, 14, 0.96), rgba(3, 9, 14, 0.99)),
    url("https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1100&q=82") center / cover;
  border-color: rgba(191, 245, 255, 0.2);
}

[data-theme="dark"] .brand strong,
[data-theme="dark"] .me-card strong,
[data-theme="dark"] .org-scope strong {
  color: #ffffff;
}

[data-theme="dark"] .brand small,
[data-theme="dark"] .me-card p,
[data-theme="dark"] .org-scope p,
[data-theme="dark"] .nav-heading,
[data-theme="dark"] .org-switcher label span,
[data-theme="dark"] .conversation-copy span {
  color: #d6edf5;
}

[data-theme="dark"] .org-switcher,
[data-theme="dark"] .me-card,
[data-theme="dark"] .global-search,
[data-theme="dark"] .rail-footer button,
[data-theme="dark"] .rail .ghost-icon {
  background: rgba(191, 245, 255, 0.12);
  border-color: rgba(191, 245, 255, 0.26);
}

[data-theme="dark"] .org-switcher select {
  color: #ffffff;
  background: #07131f;
  border-color: rgba(191, 245, 255, 0.32);
}

[data-theme="dark"] .global-search,
[data-theme="dark"] .global-search input,
[data-theme="dark"] .conversation-button,
[data-theme="dark"] .rail-footer button,
[data-theme="dark"] .rail .ghost-icon {
  color: #f8fdff;
}

[data-theme="dark"] .rail-footer .admin-return-action {
  color: #07131f;
  background: #bfefff;
  border-color: #bfefff;
}

[data-theme="dark"] .global-search input::placeholder {
  color: #b8d4de;
}

[data-theme="dark"] .conversation-button {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .conversation-button:hover,
[data-theme="dark"] .conversation-button:focus-visible {
  background: rgba(191, 245, 255, 0.14);
  border-color: rgba(191, 245, 255, 0.28);
}

[data-theme="dark"] .conversation-button.is-active {
  color: #ffffff;
  background: rgba(191, 245, 255, 0.2);
  border-color: rgba(191, 245, 255, 0.42);
  box-shadow: inset 3px 0 0 #bfefff;
}

[data-theme="dark"] .conversation-copy strong {
  color: #ffffff;
}

[data-theme="dark"] .conversation-glyph {
  color: #07131f;
  background: #bfefff;
}

[data-theme="dark"] .unread-badge {
  color: #07131f;
  background: #ffffff;
}

[data-theme="dark"] .admin-stat-grid article,
[data-theme="dark"] .admin-card {
  color: var(--ink);
  background: rgba(13, 29, 43, 0.95);
  border-color: rgba(218, 238, 247, 0.18);
}

[data-theme="dark"] .admin-card h2,
[data-theme="dark"] .admin-card strong,
[data-theme="dark"] .admin-stat-grid strong,
[data-theme="dark"] .admin-form-grid label {
  color: #ffffff;
}

[data-theme="dark"] .admin-stat-grid p,
[data-theme="dark"] .admin-card-header span,
[data-theme="dark"] .admin-metric p,
[data-theme="dark"] .admin-message-row p,
[data-theme="dark"] .admin-user-row p,
[data-theme="dark"] .admin-activity-item p {
  color: #d4e7ef;
}

[data-theme="dark"] .admin-form-grid input,
[data-theme="dark"] .admin-inline-search input {
  color: #ffffff;
  background: #07131f;
  border-color: rgba(218, 238, 247, 0.22);
}

[data-theme="dark"] .admin-form-grid input::placeholder,
[data-theme="dark"] .admin-inline-search input::placeholder {
  color: #9db7c2;
}

[data-theme="dark"] .admin-metric,
[data-theme="dark"] .admin-request-item,
[data-theme="dark"] .admin-message-row,
[data-theme="dark"] .admin-user-row,
[data-theme="dark"] .admin-activity-item {
  background: #0b1824;
  border-color: rgba(218, 238, 247, 0.16);
}

[data-theme="dark"] .admin-pill {
  color: #f7fbff;
  background: #102235;
  border-color: rgba(218, 238, 247, 0.2);
}

[data-theme="dark"] .superadmin-header {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(218, 238, 247, 0.18);
}

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

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

  .admin-stat-grid,
  .admin-org-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .context-panel {
    position: fixed;
    inset: 14px 14px 14px auto;
    z-index: 30;
    width: min(380px, calc(100% - 28px));
    transform: translateX(calc(100% + 28px));
    transition: transform 180ms ease;
  }

  .context-panel.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 860px) {
  body {
    background: var(--page);
  }

  .superadmin-shell {
    display: block;
    background: #08121b;
  }

  .superadmin-rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(216, 235, 243, 0.14);
  }

  .superadmin-main {
    padding: 14px;
  }

  .superadmin-header h1 {
    font-size: 2.5rem;
  }

  .superadmin-header,
  .admin-card-header,
  .admin-message-row,
  .admin-user-row,
  .admin-activity-item {
    display: grid;
    justify-content: stretch;
  }

  .admin-status {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .admin-inline-search {
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 0 0 72px;
    gap: 0;
  }

  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(330px, 88vw);
    height: 100vh;
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .rail.is-open {
    transform: translateX(0);
  }

  .rail-close,
  .menu-button {
    display: grid;
  }

  .messenger {
    min-height: calc(100vh - 72px);
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .chat-header {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 82px;
    padding-top: max(14px, env(safe-area-inset-top));
    background: var(--panel);
    backdrop-filter: blur(18px);
  }

  .chat-title p:last-child {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .icon-action {
    width: 38px;
    height: 38px;
  }

  .chat-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
  }

  .message-search {
    width: 100%;
  }

  .message-surface {
    padding: 18px 12px;
  }

  .composer {
    position: sticky;
    bottom: 72px;
    z-index: 12;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .composer-main {
    display: grid;
    grid-template-columns: 42px 46px 42px minmax(0, 1fr) 42px;
  }

  .send-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .composer-shortcuts {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .mobile-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }

  .mobile-tabbar button {
    min-height: 44px;
    color: var(--ink);
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 850;
  }

  [data-theme="dark"] .mobile-tabbar {
    background: rgba(16, 25, 35, 0.94);
  }
}

@media (max-width: 560px) {
  .auth-screen {
    padding: 12px;
  }

  .admin-stat-grid,
  .admin-org-metrics,
  .admin-form-grid,
  .superadmin-actions,
  .admin-request-actions {
    grid-template-columns: 1fr;
  }

  .superadmin-rail,
  .superadmin-main,
  .admin-card,
  .superadmin-header {
    padding: 14px;
  }

  .superadmin-header h1 {
    font-size: 1.85rem;
  }

  .admin-message-actions {
    min-width: 0;
  }

  .gif-tray,
  .permission-controls,
  .widget-manager-row {
    grid-template-columns: 1fr;
  }

  .gif-tray button,
  .permission-controls button {
    width: 100%;
  }

  .widget-manager-row > div:last-child {
    justify-content: flex-start;
  }

  .auth-card {
    padding: 20px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.32rem;
  }

  .chat-header {
    gap: 10px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .message {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
  }

  .message.is-mine {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .message .avatar {
    width: 34px;
    height: 34px;
    font-size: 0.68rem;
  }

  .message-bubble {
    padding: 12px;
  }

  .message-actions {
    opacity: 1;
    transform: none;
    overflow-x: auto;
  }

  .segmented-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .segmented-control button {
    padding: 0 8px;
  }

  .context-panel {
    inset: 0;
    width: 100%;
    height: calc(100vh - 72px);
    border-radius: 0;
  }

  .install-banner {
    right: 10px;
    bottom: 82px;
    left: 10px;
    max-width: none;
  }
}
