:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --panel-3: #e7ebf0;
  --text: #050505;
  --muted: #6b7280;
  --line: #dde3ec;
  --accent: #0866ff;
  --accent-2: #0084ff;
  --danger: #d92d20;
  --online: #31a24c;
  --pin: #fff4cc;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  --chat-bg: #f7f9fc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.25;
}

.app-shell {
  display: grid;
  grid-template-columns: 76px minmax(320px, 360px) minmax(0, 1fr) minmax(300px, 336px);
  height: 100vh;
  gap: 0;
  overflow: hidden;
  background: var(--panel);
}

.rail,
.inbox,
.chat-panel,
.details {
  min-height: 0;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.brand-mark,
.auth-logo {
  display: grid;
  place-items: center;
}

.brand-mark img,
.auth-logo img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
}

.rail-button,
.icon-button,
.mobile-tab {
  border: 0;
  min-width: 40px;
  height: 40px;
}

.rail-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.rail-button {
  width: 50px;
  height: 50px;
  position: relative;
}

.rail-button.active,
.rail-button:hover,
.icon-button:hover {
  background: #e8f1ff;
  color: var(--accent);
}

.rail-button.active::before {
  content: "";
  width: 4px;
  height: 24px;
  border-radius: 999px;
  position: absolute;
  left: -10px;
  top: 12px;
  background: var(--accent);
}

.rail-button.bottom {
  margin-top: auto;
}

.icon-button {
  background: var(--panel-3);
  color: #1c1e21;
}

.icon-button.prominent,
.send-button {
  background: var(--accent);
  color: #ffffff;
}

.gif-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.inbox {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 10px 0;
}

.inbox-header,
.chat-header,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inbox-title-stack {
  min-width: 0;
}

.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.inbox-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.search-box {
  min-height: 40px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 12px 0 10px;
  padding: 0 13px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
}

.search-box.compact {
  margin: 10px 0 14px;
}

.search-box input,
.field input,
.field select,
.composer input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.search-box input {
  height: 40px;
  min-width: 0;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 8px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  border: 0;
  background: #eef2f7;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 11px;
  color: var(--text);
  white-space: nowrap;
  font-weight: 700;
  font-size: 13px;
}

.chip.active {
  background: #dbeafe;
  color: var(--accent);
}

.conversation-list {
  overflow: auto;
  padding: 2px 0 24px;
}

.story-strip {
  display: none;
}

.story-card {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  padding: 0;
}

.story-avatar {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin: 0 auto 8px;
}

.story-avatar.story-avatar-create {
  background: #242526;
  color: #ffffff;
}

.story-name {
  display: block;
  max-width: 72px;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.conversation-card {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
}

.conversation-card:hover,
.conversation-card.active {
  background: #eef3fb;
}

.conversation-card.active .conversation-title strong {
  color: var(--accent);
}

.conversation-card.unread .conversation-title strong,
.conversation-card.unread .preview {
  color: var(--text);
}

.avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a67ff, #25a0ff);
  color: #ffffff;
  font-weight: 900;
  position: relative;
  overflow: hidden;
}

.avatar.small,
.message-avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.avatar-photo {
  background: #242526;
}

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

.status-dot {
  width: 13px;
  height: 13px;
  background: var(--online);
  border: 2px solid var(--panel);
  border-radius: 50%;
  position: absolute;
  right: 1px;
  bottom: 1px;
}

.conversation-title {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  line-height: 1.2;
}

.conversation-title strong,
.message-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta,
.preview,
.message-meta {
  color: var(--muted);
  font-size: 12px;
}

.conversation-meta {
  justify-self: end;
  white-space: nowrap;
}

.conversation-meta-stack {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 6px;
}

.preview {
  display: block;
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(8, 102, 255, 0.2);
}

.conversation-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(8, 102, 255, 0.14);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.conversation-unread-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--chat-bg);
}

.chat-header {
  min-height: 72px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.chat-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-person strong {
  display: block;
  line-height: 1.2;
}

.presence-line {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

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

.chat-actions .icon-button {
  background: transparent;
  color: var(--accent);
}

.mobile-back {
  display: none;
}

.pinned-banner {
  display: none;
  padding: 9px 18px;
  background: var(--pin);
  border-bottom: 1px solid #f1df96;
  color: #6b5600;
  font-size: 13px;
}

.pinned-banner.visible {
  display: block;
}

.messages {
  overflow: auto;
  padding: 20px 22px 16px;
  background:
    linear-gradient(180deg, rgba(237, 242, 249, 0.85), rgba(248, 250, 253, 0.96)),
    var(--chat-bg);
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.message-row.mine {
  justify-content: flex-end;
}

.message {
  max-width: min(660px, 70%);
}

.message-sender {
  margin: 0 0 3px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bubble {
  border-radius: 18px;
  padding: 10px 13px;
  background: #ffffff;
  color: var(--text);
  word-break: break-word;
  line-height: 1.38;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03), 0 8px 18px rgba(15, 23, 42, 0.05);
}

.mine .bubble {
  background: linear-gradient(180deg, #1481ff, #0866ff);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(8, 102, 255, 0.2);
}

.message-toolbar {
  display: flex;
  gap: 5px;
  margin-top: 5px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.message-row:hover .message-toolbar {
  opacity: 1;
}

.mini-action {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.mini-action svg {
  width: 15px;
  height: 15px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: -2px;
  margin-left: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.voice-bubble {
  min-width: 230px;
}

.voice-line {
  display: grid;
  grid-template-columns: 30px minmax(110px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: rgba(0, 132, 255, 0.2);
  overflow: hidden;
}

.mine .progress {
  background: rgba(255, 255, 255, 0.25);
}

.progress span {
  display: block;
  height: 100%;
  width: 46%;
  background: currentColor;
  opacity: 0.72;
}

.transcript {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  font-size: 13px;
}

.composer {
  padding: 10px 16px 14px;
  background: rgba(255, 255, 255, 0.99);
  border-top: 1px solid var(--line);
}

.composer-row {
  display: grid;
  grid-template-columns: repeat(4, 40px) minmax(0, 1fr) 40px 40px;
  gap: 7px;
  align-items: center;
}

.composer-row .icon-button {
  background: transparent;
  color: var(--accent);
}

.composer input {
  height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  background: #eff2f6;
}

.send-button,
.primary-button,
.secondary-button {
  border-radius: 999px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 800;
}

.send-button {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.secondary-button {
  background: var(--panel-2);
  border-color: transparent;
  color: var(--text);
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  min-height: 42px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
}

.download-link-prominent {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}

.reply-preview {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: #eef3fb;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.message-pending .bubble {
  box-shadow: inset 0 0 0 1px rgba(8, 102, 255, 0.18);
}

.details {
  overflow: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 16px 14px;
}

.details-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.details-card.profile-card {
  text-align: center;
  padding-top: 22px;
}

.details-card.profile-card .avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  font-size: 24px;
}

.details-card h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.settings-list,
.action-list {
  display: grid;
  gap: 6px;
}

.list-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  padding: 9px 8px;
  font-weight: 700;
}

.list-button:hover {
  background: #f3f6fb;
}

.list-button.danger {
  color: var(--danger);
}

.full-width {
  width: 100%;
}

.attachment-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 8px;
}

.settings-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-row strong {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.muted-value {
  color: var(--muted);
  font-weight: 500;
}

.sensitive-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.private-actions {
  margin-top: 14px;
}

.list-button:disabled,
.icon-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  background: var(--panel);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(5, 5, 5, 0.42);
}

.theme-preview {
  min-height: 150px;
  margin: 14px 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  background: var(--chat-bg);
}

.theme-grid,
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  max-height: 330px;
  overflow: auto;
  padding: 2px;
}

.theme-option,
.picker-option {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 72px;
  padding: 10px;
  background: var(--panel-2);
  text-align: left;
}

.theme-option.active {
  outline: 3px solid rgba(8, 102, 255, 0.18);
  border-color: var(--accent);
}

.theme-swatch {
  height: 34px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.modal-actions,
.voice-controls {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}

.voice-recorder {
  display: grid;
  gap: 14px;
}

.waveform {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.waveform span {
  width: 9px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
}

.waveform span:nth-child(2),
.waveform span:nth-child(5) {
  height: 52px;
}

.waveform span:nth-child(3) {
  height: 66px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.field input,
.field select {
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--panel-2);
}

.field textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  outline: none;
}

.field input:disabled {
  color: var(--muted);
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.transcript-box {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 12px;
  color: var(--muted);
}

.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.settings-menu {
  display: grid;
  gap: 7px;
  align-content: start;
}

.settings-content {
  border: 0;
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel-2);
}

.settings-banner {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.settings-banner strong {
  display: block;
  margin-bottom: 4px;
}

.settings-banner p {
  margin: 0;
  color: var(--muted);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

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

.settings-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.settings-stack {
  display: grid;
  gap: 6px;
}

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

.field-span-2 {
  grid-column: 1 / -1;
}

.toggle {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  position: relative;
}

.toggle::after {
  content: "";
  width: 20px;
  height: 20px;
  position: absolute;
  right: 3px;
  top: 3px;
  border-radius: 50%;
  background: #ffffff;
}

.panel-view {
  display: none;
  padding: 18px;
  overflow: auto;
}

.panel-view.active {
  display: block;
}

.mobile-nav {
  display: none;
}

.mobile-ai-pill {
  display: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat {
  border: 0;
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel-2);
}

.stat strong {
  display: block;
  font-size: 24px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(8, 102, 255, 0.24), transparent 24%),
    radial-gradient(circle at 85% 18%, rgba(109, 40, 217, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(37, 160, 255, 0.18), transparent 26%),
    linear-gradient(180deg, #05070c, #0a0d14 58%, #06080d);
}

.connection-banner {
  grid-column: 1 / -1;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  line-height: 1.4;
}

.connection-banner.offline {
  background: #fff8d6;
  color: #574500;
}

.connection-banner.online {
  background: #ecfdf3;
  color: #166534;
}

.auth-card {
  width: min(1180px, 100%);
  border-radius: 28px;
  background: rgba(8, 11, 17, 0.92);
  color: #f5f7fb;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.12);
  backdrop-filter: blur(22px);
  padding: 30px;
  margin: auto 0;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 430px);
  gap: 30px;
  align-items: start;
}

.auth-showcase {
  display: grid;
  gap: 18px;
  align-content: start;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-logo {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
}

.auth-showcase h1 {
  margin-bottom: 0;
  font-size: 40px;
  line-height: 1.02;
}

.auth-lead,
.auth-panel-copy {
  color: #c6cedb;
  line-height: 1.55;
}

.auth-step-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #8ec5ff;
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.auth-preview {
  display: grid;
  gap: 10px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, rgba(10, 12, 18, 0.96), rgba(20, 24, 34, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  padding: 18px;
}

.preview-thread {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.preview-thread.active {
  outline: 2px solid rgba(8, 102, 255, 0.26);
}

.preview-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a67ff, #25a0ff);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.preview-avatar.accent {
  background: linear-gradient(135deg, #db2777, #f97316);
}

.preview-thread-copy {
  min-width: 0;
}

.preview-thread-copy strong,
.preview-thread-copy span,
.preview-thread small {
  display: block;
}

.preview-thread-copy span,
.preview-thread small {
  color: #9da7b7;
  font-size: 12px;
}

.preview-thread-copy span {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-bubbles {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.preview-bubble {
  max-width: 82%;
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
}

.preview-bubble.incoming {
  background: #20242e;
  color: #f5f7fb;
}

.preview-bubble.outgoing {
  justify-self: end;
  background: var(--accent);
  color: #ffffff;
}

.preview-bubble.outgoing.soft {
  background: linear-gradient(135deg, #0a67ff, #25a0ff);
}

.auth-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-feature {
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.auth-feature strong,
.auth-feature span {
  display: block;
}

.auth-feature strong {
  margin-bottom: 6px;
  font-size: 14px;
}

.auth-feature span {
  color: #aeb8c8;
  font-size: 13px;
  line-height: 1.45;
}

.auth-panel {
  display: grid;
  gap: 0;
  border-radius: 24px;
  background: rgba(15, 19, 28, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.auth-panel h2 {
  margin-bottom: 8px;
}

.auth-download-stack {
  margin-top: 16px;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}

.auth-register-fields {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  margin-top: 2px;
  padding-top: 14px;
}

.section-caption {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.checkbox-field {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #aeb8c8;
  font-size: 13px;
  line-height: 1.5;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.auth-confirmation-panel {
  display: grid;
  gap: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.1);
  padding: 12px;
}

.auth-otp-actions {
  display: flex;
  gap: 10px;
}

.auth-status {
  margin-top: 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f7fb;
  padding: 11px 12px;
  text-align: left;
  line-height: 1.4;
}

.auth-status.success {
  border-color: rgba(22, 163, 74, 0.25);
  background: #ecfdf3;
  color: #166534;
}

.auth-status.error {
  border-color: rgba(220, 38, 38, 0.25);
  background: #fef2f2;
  color: #991b1b;
}

.auth-help-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.auth-help-actions .secondary-button {
  width: 100%;
}

.auth-quick-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.auth-support-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.build-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  padding: 0;
}

.inline-link-button.subtle {
  color: var(--muted);
}

.inline-link-button:hover {
  text-decoration: underline;
}

.setup-warning {
  margin-top: 16px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border-radius: var(--radius);
  padding: 12px;
  line-height: 1.45;
  text-align: left;
}

.auth-screen .field input,
.auth-screen .field select,
.auth-screen .field textarea {
  min-height: 52px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: #f5f7fb;
  padding: 0 14px;
}

.auth-screen .field textarea {
  min-height: 120px;
  padding: 12px 14px;
}

.auth-screen .field input::placeholder,
.auth-screen .field textarea::placeholder {
  color: #8390a4;
}

.app-shell.locked {
  filter: blur(2px);
  pointer-events: none;
}

.verification-content {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

.verification-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  padding: 14px;
}

.verification-card strong,
.verification-card span {
  display: block;
}

.verification-card strong {
  margin-bottom: 4px;
}

.verification-card span {
  color: var(--muted);
  line-height: 1.45;
}

.verification-card.success {
  border-color: rgba(22, 163, 74, 0.24);
  background: #ecfdf3;
}

.verification-card.success span {
  color: #166534;
}

.verification-card.pending {
  border-color: rgba(8, 102, 255, 0.16);
  background: #eef5ff;
}

.verification-stack {
  display: grid;
  gap: 12px;
}

.verification-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.verification-inline .primary-button,
.verification-inline .secondary-button {
  flex: 1 1 180px;
}

.modal-wide {
  width: min(860px, calc(100vw - 28px));
}

.info-content {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.info-intro {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  line-height: 1.5;
}

.info-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.info-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-section h3 {
  margin-bottom: 8px;
}

.info-section p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.info-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

body.app-active,
body.dark {
  --bg: #101214;
  --panel: #000000;
  --panel-2: #1c1c1e;
  --panel-3: #2c2c2e;
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --line: #232326;
  --chat-bg: #080809;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

body.app-active .rail,
body.app-active .inbox,
body.app-active .chat-header,
body.app-active .composer,
body.app-active .details,
body.app-active .mobile-nav {
  background: var(--panel);
}

body.app-active .search-box,
body.app-active .chip,
body.app-active .composer input,
body.app-active .field input,
body.app-active .field select,
body.app-active .field textarea,
body.app-active .icon-button,
body.app-active .mini-action,
body.app-active .details-card,
body.app-active .settings-content,
body.app-active .theme-option,
body.app-active .picker-option,
body.app-active .theme-preview,
body.app-active .transcript-box,
body.app-active .waveform,
body.app-active .auth-confirmation-panel {
  background: var(--panel-2);
}

body.app-active .icon-button.prominent,
body.app-active .send-button,
body.app-active .primary-button,
body.app-active .download-link {
  background: var(--accent);
}

body.app-active .chat-actions .icon-button,
body.app-active .composer-row .icon-button {
  background: transparent;
}

body.app-active .build-badge {
  background: #17181a;
  color: var(--muted);
}

body.app-active .bubble {
  background: #232427;
  color: var(--text);
  box-shadow: none;
}

body.app-active .mine .bubble {
  background: linear-gradient(180deg, #1481ff, #0866ff);
  color: #ffffff;
}

body.app-active .conversation-card:hover,
body.app-active .conversation-card.active {
  background: #131316;
}

body.app-active .message-toolbar,
body.app-active .reaction-pill {
  color: var(--text);
}

body.app-active .reaction-pill {
  background: #17181a;
  border-color: var(--line);
}

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

  .details {
    display: none;
  }

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

  .auth-card {
    width: min(720px, 100%);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - 60px);
  }

  .rail,
  .details {
    display: none;
  }

  .inbox {
    display: flex;
    padding: 14px 14px 0;
  }

  .inbox-header {
    align-items: flex-start;
  }

  .inbox-title-stack h1 {
    font-size: 28px;
    font-weight: 900;
  }

  .section-subtitle {
    font-size: 12px;
  }

  .search-box {
    margin: 14px 0 10px;
    min-height: 50px;
    padding: 0 16px;
  }

  .search-box input {
    height: 50px;
    font-size: 17px;
  }

  .story-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 76px;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0 14px;
    scrollbar-width: none;
  }

  .story-strip::-webkit-scrollbar {
    display: none;
  }

  .filters {
    display: none;
  }

  .chat-panel {
    display: none;
  }

  .app-shell.chat-open .inbox {
    display: none;
  }

  .app-shell.chat-open .chat-panel {
    display: grid;
  }

  .mobile-back {
    display: inline-grid;
  }

  .chat-header {
    min-height: 62px;
    padding: 9px 10px;
  }

  .chat-actions {
    gap: 4px;
  }

  .composer {
    padding: 8px 8px 10px;
  }

  .composer-row {
    grid-template-columns: repeat(2, 40px) minmax(0, 1fr) 40px 40px;
  }

  #stickerButton,
  #gifButton {
    display: none;
  }

  .messages {
    padding: 16px 10px 10px;
  }

  .message {
    max-width: 82%;
  }

  .conversation-list {
    padding-bottom: 120px;
  }

  .conversation-card {
    min-height: 84px;
    padding: 12px 2px;
    border-radius: 0;
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }

  .conversation-card .avatar {
    width: 56px;
    height: 56px;
  }

  .preview {
    font-size: 14px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--panel);
    border-top: 1px solid var(--line);
    z-index: 20;
  }

  .mobile-tab {
    height: 72px;
    display: grid;
    place-items: center;
    gap: 4px;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-tab svg {
    width: 22px;
    height: 22px;
  }

  .mobile-tab.active {
    color: var(--accent);
  }

  .mobile-ai-pill {
    position: fixed;
    right: 14px;
    bottom: 86px;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 999px;
    background: #242526;
    color: #ffffff;
    padding: 0 18px 0 14px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
    z-index: 19;
  }

  .mobile-ai-orb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 35% 35%, #c084fc 0, #c084fc 26%, transparent 27%),
      radial-gradient(circle at 70% 35%, #9333ea 0, #9333ea 24%, transparent 25%),
      radial-gradient(circle at 50% 70%, #6366f1 0, #6366f1 24%, transparent 25%),
      linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.28);
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .profile-form-grid {
    grid-template-columns: 1fr;
  }

  .auth-screen {
    padding: 14px;
  }

  .auth-card {
    padding: 18px;
    border-radius: 16px;
  }

  .auth-showcase h1 {
    font-size: 28px;
  }

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

  .auth-brand-row {
    align-items: flex-start;
  }

  .auth-logo {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .preview-bubble {
    max-width: 92%;
  }
}

/* Messenger-inspired dark mode refresh */
body.app-active {
  background:
    radial-gradient(circle at top, rgba(0, 132, 255, 0.12), transparent 24%),
    #0b0d10;
}

body.app-active .app-shell {
  grid-template-columns: 84px minmax(320px, 390px) minmax(0, 1fr) minmax(300px, 360px);
  background: #0b0d10;
}

body.app-active .rail,
body.app-active .inbox,
body.app-active .chat-panel,
body.app-active .chat-header,
body.app-active .composer,
body.app-active .details,
body.app-active .mobile-nav {
  background: #111216;
}

body.app-active .rail {
  gap: 12px;
  padding: 16px 12px;
  border-right-color: rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, #111216, #0d0f12);
}

body.app-active .brand-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  padding: 7px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(0, 132, 255, 0.2), rgba(0, 132, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(89, 175, 255, 0.16);
}

body.app-active .rail-button {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  color: #b3bcc7;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

body.app-active .rail-button.active,
body.app-active .rail-button:hover {
  background: rgba(0, 132, 255, 0.14);
  color: #57b2ff;
  transform: translateY(-1px);
}

body.app-active .rail-button.active::before {
  left: -12px;
  top: 16px;
  height: 22px;
  background: #0a84ff;
}

body.app-active .inbox {
  position: relative;
  padding: 16px 12px 0;
  border-right-color: rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, #111216, #101216);
}

body.app-active .inbox-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 2px 6px 14px;
  background: linear-gradient(180deg, rgba(17, 18, 22, 0.98), rgba(17, 18, 22, 0.92) 78%, rgba(17, 18, 22, 0));
  backdrop-filter: blur(18px);
}

body.app-active .inbox-header.elevated,
body.app-active .chat-header.elevated {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

body.app-active .inbox-title-stack h1 {
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 0;
}

body.app-active .section-subtitle {
  margin-top: 5px;
  color: #8b95a1;
  font-size: 13px;
}

body.app-active .inbox-header-actions .icon-button {
  width: 42px;
  height: 42px;
  background: #1b1e23;
  color: #eef2f7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

body.app-active .inbox-header-actions .icon-button.prominent {
  background: #0a84ff;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(10, 132, 255, 0.22);
}

body.app-active .search-box {
  min-height: 48px;
  margin: 0 4px 12px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #1a1d22;
  color: #97a1ad;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

body.app-active .search-box input::placeholder,
body.app-active .composer input::placeholder,
body.app-active .field input::placeholder,
body.app-active .field textarea::placeholder {
  color: #8b95a1;
}

body.app-active .filters {
  gap: 10px;
  padding: 0 4px 12px;
}

body.app-active .chip {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #1b1e23;
  color: #d3d8df;
}

body.app-active .chip.active {
  background: rgba(10, 132, 255, 0.16);
  border-color: rgba(10, 132, 255, 0.22);
  color: #67baff;
}

body.app-active .conversation-list {
  display: grid;
  gap: 4px;
  padding: 4px 4px 28px;
}

body.app-active .conversation-card {
  min-height: 84px;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  color: #f5f7fa;
  transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

body.app-active .conversation-card:hover,
body.app-active .conversation-card.active {
  background: #1a1d22;
}

body.app-active .conversation-card.active {
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.24);
}

body.app-active .conversation-card.unread {
  background: linear-gradient(180deg, rgba(17, 36, 60, 0.5), rgba(17, 18, 22, 0.8));
}

body.app-active .conversation-card.active .conversation-title strong,
body.app-active .conversation-card.unread .conversation-title strong,
body.app-active .conversation-card.unread .preview {
  color: #f9fbff;
}

body.app-active .conversation-title {
  gap: 10px;
}

body.app-active .conversation-title strong {
  font-size: 15px;
  font-weight: 700;
}

body.app-active .preview,
body.app-active .conversation-meta,
body.app-active .message-meta,
body.app-active .attachment-meta,
body.app-active .presence-line,
body.app-active .field-note {
  color: #8b95a1;
}

body.app-active .preview {
  margin-top: 5px;
  font-size: 13px;
}

body.app-active .conversation-meta-stack {
  gap: 8px;
}

body.app-active .conversation-tag {
  min-height: 20px;
  padding: 0 8px;
  background: rgba(10, 132, 255, 0.16);
  color: #68bbff;
}

body.app-active .conversation-unread-dot {
  width: 12px;
  height: 12px;
  background: #0a84ff;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

body.app-active .badge {
  min-width: 22px;
  height: 22px;
  background: #0a84ff;
  box-shadow: none;
}

body.app-active .avatar {
  width: 56px;
  height: 56px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

body.app-active .message-avatar {
  width: 32px;
  height: 32px;
}

body.app-active .status-dot {
  border-color: #111216;
}

body.app-active .chat-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at top, rgba(0, 132, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #101216, #0b0d10);
}

body.app-active .chat-header {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 76px;
  padding: 12px 18px;
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: rgba(17, 18, 22, 0.92);
  backdrop-filter: blur(18px);
}

body.app-active .chat-person {
  gap: 12px;
}

body.app-active .chat-person > span {
  min-width: 0;
  flex: 1 1 auto;
}

body.app-active .chat-person strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.app-active .presence-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.app-active .chat-actions {
  gap: 10px;
}

body.app-active .chat-actions .icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1b1e23;
  color: #44a8ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

body.app-active .pinned-banner {
  padding: 11px 18px;
  background: rgba(10, 132, 255, 0.1);
  border-bottom: 1px solid rgba(10, 132, 255, 0.16);
  color: #a8d8ff;
}

body.app-active .messages {
  padding: 22px 22px 12px;
  background:
    radial-gradient(circle at top, rgba(0, 132, 255, 0.08), transparent 32%),
    linear-gradient(180deg, #101216, #0b0d10);
}

body.app-active .message-row {
  gap: 10px;
  margin-bottom: 14px;
}

body.app-active .message {
  max-width: min(680px, 68%);
}

body.app-active .message-sender {
  margin-bottom: 5px;
  color: #a7b0bb;
}

body.app-active .bubble {
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  background: #1a1d22;
  color: #f5f7fa;
  line-height: 1.45;
}

body.app-active .mine .bubble {
  background: linear-gradient(180deg, #1a92ff, #0a84ff);
  box-shadow: 0 12px 24px rgba(10, 132, 255, 0.22);
}

body.app-active .message-meta {
  margin-top: 5px;
  padding: 0 4px;
  font-size: 11px;
}

body.app-active .mini-action {
  border-color: rgba(255, 255, 255, 0.06);
  background: #15181c;
  color: #c1c8d0;
  box-shadow: none;
}

body.app-active .reaction-pill {
  background: #16191d;
}

body.app-active .transcript {
  background: rgba(255, 255, 255, 0.12);
}

body.app-active .composer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top-color: rgba(255, 255, 255, 0.06);
  background: rgba(17, 18, 22, 0.94);
  backdrop-filter: blur(20px);
}

body.app-active .composer:focus-within {
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.18);
}

body.app-active .composer.is-typing .composer-row {
  filter: saturate(1.04);
}

body.app-active .reply-preview {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-left-width: 4px;
  border-radius: 14px;
  background: #181c22;
  color: #b7c0cb;
}

body.app-active .composer-row {
  grid-template-columns: repeat(4, 44px) minmax(0, 1fr) 44px 44px;
  gap: 8px;
  align-items: center;
}

body.app-active .composer-row .icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #44a8ff;
}

body.app-active .composer-row .icon-button:hover {
  background: #1a1d22;
}

body.app-active .composer input {
  height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #1a1d22;
  color: #f5f7fa;
}

body.app-active .send-button {
  width: 44px;
  min-height: 44px;
  box-shadow: 0 10px 22px rgba(10, 132, 255, 0.24);
}

body.app-active .details {
  padding: 18px 14px 24px;
  border-left-color: rgba(255, 255, 255, 0.06);
}

body.app-active .details-card {
  border-color: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  background: #181b20;
  box-shadow: none;
}

body.app-active .list-button {
  border-radius: 12px;
}

body.app-active .list-button:hover {
  background: #20242a;
}

body.app-active .theme-option,
body.app-active .picker-option,
body.app-active .theme-preview,
body.app-active .transcript-box,
body.app-active .waveform,
body.app-active .settings-content,
body.app-active .auth-confirmation-panel,
body.app-active .details-card,
body.app-active .field input,
body.app-active .field select,
body.app-active .field textarea {
  border-color: rgba(255, 255, 255, 0.05);
}

body.app-active .mobile-ai-pill {
  background: rgba(19, 22, 27, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.app-active .mobile-ai-pill span:last-child {
  font-weight: 700;
}

@media (max-width: 1120px) {
  body.app-active .app-shell {
    grid-template-columns: 72px 350px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body.app-active .app-shell {
    height: calc(100vh - 76px - env(safe-area-inset-bottom));
    background: #0b0d10;
  }

  body.app-active .inbox {
    padding: 12px 12px 0;
  }

  body.app-active .inbox-header {
    padding: 0 4px 12px;
  }

  body.app-active .inbox-title-stack h1 {
    font-size: 32px;
  }

  body.app-active .search-box {
    min-height: 52px;
    margin: 0 2px 12px;
    padding: 0 16px;
  }

  body.app-active .search-box input {
    height: 50px;
  }

  body.app-active .story-strip {
    padding: 4px 2px 14px;
    gap: 10px;
  }

  body.app-active .story-avatar {
    width: 64px;
    height: 64px;
    border: 2px solid rgba(10, 132, 255, 0.46);
    background: #171b21;
  }

  body.app-active .story-avatar.story-avatar-create {
    background: #1b1e23;
  }

  body.app-active .conversation-list {
    gap: 6px;
    padding: 4px 0 calc(136px + env(safe-area-inset-bottom));
  }

  body.app-active .conversation-card {
    min-height: 80px;
    margin: 0 2px;
    padding: 12px;
    border-radius: 20px;
    grid-template-columns: 62px minmax(0, 1fr) auto;
  }

  body.app-active .conversation-card .avatar {
    width: 54px;
    height: 54px;
  }

  body.app-active .chat-header {
    min-height: 68px;
    padding: 10px 8px 10px 6px;
  }

  body.app-active .mobile-back {
    background: #1b1e23;
    color: #f5f7fa;
  }

  body.app-active .chat-actions {
    gap: 6px;
  }

  body.app-active .chat-actions .icon-button {
    width: 36px;
    height: 36px;
  }

  body.app-active .messages {
    padding: 16px 12px 10px;
  }

  body.app-active .message {
    max-width: 86%;
  }

  body.app-active .composer {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(10, 12, 15, 0.96);
  }

  body.app-active .composer-row {
    grid-template-columns: 40px 40px minmax(0, 1fr) 40px 40px;
    gap: 6px;
    padding: 6px;
    border-radius: 26px;
    background: #111418;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  }

  body.app-active .composer-row .icon-button,
  body.app-active .send-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  body.app-active .composer input {
    height: 40px;
    padding: 0 14px;
    border: 0;
    background: transparent;
  }

  body.app-active .mobile-nav {
    height: calc(76px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top-color: rgba(255, 255, 255, 0.06);
    background: rgba(17, 18, 22, 0.96);
    backdrop-filter: blur(20px);
  }

  body.app-active .mobile-tab {
    position: relative;
    height: 76px;
    gap: 5px;
    color: #8b95a1;
  }

  body.app-active .mobile-tab.active {
    color: #59b5ff;
  }

  body.app-active .mobile-tab.active::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 34px;
    height: 4px;
    border-radius: 999px;
    transform: translateX(-50%);
    background: #0a84ff;
  }

  body.app-active .mobile-ai-pill {
    right: 12px;
    bottom: calc(90px + env(safe-area-inset-bottom));
    min-height: 48px;
    padding: 0 14px 0 12px;
    gap: 10px;
  }

  body.app-active .mobile-ai-pill span:last-child {
    font-size: 13px;
  }

  .app-shell.chat-open ~ .mobile-ai-pill {
    display: none;
  }
}
