:root {
  --bg: #0c1220;
  --bg-soft: rgba(12, 18, 32, 0.72);
  --panel: rgba(17, 25, 40, 0.68);
  --panel-strong: rgba(18, 27, 46, 0.88);
  --text: #eef3ff;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.16);
  --accent: #34a4ff;
  --accent-soft: rgba(52, 164, 255, 0.18);
  --success: #36c88c;
  --warning: #f0b14e;
  --danger: #ff6b81;
  --bubble-in: rgba(255, 255, 255, 0.06);
  --bubble-out: linear-gradient(180deg, rgba(61, 151, 255, 0.92), rgba(31, 118, 217, 0.92));
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --backdrop: blur(22px);
}

body.light {
  --bg: #ebf2fb;
  --bg-soft: rgba(255, 255, 255, 0.76);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --text: #10213b;
  --muted: #66768d;
  --line: rgba(102, 118, 141, 0.16);
  --accent: #2296f3;
  --accent-soft: rgba(34, 150, 243, 0.14);
  --bubble-in: rgba(13, 39, 73, 0.06);
  --bubble-out: linear-gradient(180deg, rgba(67, 171, 255, 0.95), rgba(38, 133, 255, 0.92));
  --shadow: 0 22px 45px rgba(57, 86, 130, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(52, 164, 255, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(143, 92, 255, 0.12), transparent 32%),
    radial-gradient(circle at bottom, rgba(40, 196, 140, 0.09), transparent 35%),
    var(--bg);
}

body {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

input,
textarea {
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
}

.hidden {
  display: none !important;
}

.background-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.6;
  pointer-events: none;
}

.orb-1 {
  width: 280px;
  height: 280px;
  top: -60px;
  left: -80px;
  background: rgba(66, 153, 225, 0.24);
}

.orb-2 {
  width: 320px;
  height: 320px;
  bottom: -120px;
  left: 28%;
  background: rgba(45, 212, 191, 0.18);
}

.orb-3 {
  width: 360px;
  height: 360px;
  right: -140px;
  top: 20%;
  background: rgba(167, 139, 250, 0.2);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 108px 380px minmax(480px, 1fr) 340px;
  gap: 16px;
  width: min(1800px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
}

.glass-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
}

body[data-glass="off"] .glass-panel,
body[data-glass="off"] .glass-chip {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nav-rail,
.chats-panel,
.chat-panel,
.alt-view,
.details-panel,
.auth-card,
.story-modal,
.settings-modal,
.mobile-nav {
  border-radius: var(--radius-xl);
}

.nav-rail,
.chats-panel,
.chat-panel,
.alt-view,
.details-panel {
  min-height: 0;
}

.nav-rail {
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.brand-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, rgba(97, 201, 255, 1), rgba(24, 128, 244, 1));
  box-shadow: 0 14px 24px rgba(31, 118, 217, 0.3);
}

.brand-badge.large {
  width: 76px;
  height: 76px;
  border-radius: 24px;
}

.brand-plane svg {
  width: 26px;
  height: 26px;
}

.brand-badge.large svg {
  width: 34px;
  height: 34px;
}

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

.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail-btn,
.mobile-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 18px;
  color: var(--muted);
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.rail-btn:hover,
.mobile-tab:hover,
.story-pill:hover,
.chat-button:hover,
.soft-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.rail-btn.active,
.mobile-tab.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
}

.rail-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.rail-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glass-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar,
.story-avatar,
.avatar-preview,
.details-avatar {
  display: inline-grid;
  place-items: center;
  color: white;
  font-weight: 700;
  user-select: none;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  font-size: 0.88rem;
}

.avatar-me {
  background: linear-gradient(135deg, #34a4ff, #7c3aed);
}

.chats-panel,
.chat-panel,
.alt-view,
.details-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

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

.panel-header.compact {
  padding-right: 52px;
}

.soft-button,
.primary-button,
.folder-chip,
.reaction-chip,
.inline-action,
.status-chip,
.filter-pill,
.summary-pill,
.tag-pill,
.call-card button,
.discover-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  transition: transform 0.22s ease, background 0.22s ease, color 0.22s ease,
    border-color 0.22s ease;
}

.soft-button,
.folder-chip,
.inline-action,
.filter-pill,
.summary-pill,
.call-card button,
.discover-card button {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.soft-button {
  padding: 10px 14px;
}

.primary-button {
  padding: 12px 18px;
  color: white;
  background: linear-gradient(135deg, rgba(76, 175, 255, 1), rgba(37, 118, 221, 1));
  box-shadow: 0 10px 20px rgba(37, 118, 221, 0.25);
}

.icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
}

.search-block {
  padding: 14px 18px 10px;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

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

.search-input input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

.stories-strip-wrapper {
  padding: 6px 14px 10px;
}

.stories-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: none;
}

.stories-strip::-webkit-scrollbar,
.chat-list-wrap::-webkit-scrollbar,
.message-list::-webkit-scrollbar,
.details-body::-webkit-scrollbar,
.story-content::-webkit-scrollbar,
.calls-content::-webkit-scrollbar,
.discover-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.story-pill {
  min-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.story-pill.active-story .story-avatar,
.story-pill.unseen .story-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 0 0 5px rgba(52, 164, 255, 0.34);
}

.story-avatar {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  font-size: 1.25rem;
  background: linear-gradient(135deg, rgba(80, 170, 255, 1), rgba(146, 90, 255, 1));
}

.story-name {
  width: 100%;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.1;
}

.folder-row {
  display: flex;
  gap: 8px;
  padding: 0 18px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.folder-chip {
  padding: 9px 14px;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--muted);
}

.folder-chip.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(52, 164, 255, 0.28);
}

.chat-list-wrap {
  overflow: auto;
  min-height: 0;
  padding: 0 10px 12px;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-item {
  width: 100%;
}

.chat-button {
  width: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  border-radius: 20px;
  background: transparent;
  transition: background 0.22s ease, transform 0.22s ease;
}

.chat-item.active .chat-button {
  background: rgba(255, 255, 255, 0.08);
}

.avatar-wrap {
  position: relative;
}

.avatar-wrap .avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 1rem;
}

.online-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--panel-strong);
  background: var(--success);
}

.chat-meta {
  min-width: 0;
}

.chat-top-line,
.chat-preview-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.chat-top-line {
  margin-bottom: 6px;
}

.chat-title,
.chat-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title {
  font-weight: 650;
}

.chat-preview-line {
  color: var(--muted);
  font-size: 0.86rem;
}

.chat-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.unread-pill,
.type-pill,
.protect-pill,
.pin-pill,
.verified-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
}

.unread-pill {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.type-pill,
.protect-pill,
.pin-pill,
.verified-pill,
.status-chip,
.tag-pill {
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.main-stack {
  min-width: 0;
  min-height: 0;
  position: relative;
}

.chat-panel,
.alt-view {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.chat-panel.active-view,
.alt-view.active-view {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chat-header {
  gap: 14px;
}

.chat-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.chat-heading {
  min-width: 0;
}

.chat-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pinned-strip,
.reply-banner {
  margin: 12px 18px 0;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.pinned-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.pinned-strip .pin-content {
  min-width: 0;
}

.pin-title,
.reply-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 4px;
}

.pin-text,
.reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-list,
.calls-content,
.discover-content,
.story-content,
.details-body {
  overflow: auto;
}

.message-list {
  padding: 20px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(52, 164, 255, 0.08), transparent 25%),
    radial-gradient(circle at 100% 100%, rgba(143, 92, 255, 0.08), transparent 25%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%);
}

.day-separator {
  align-self: center;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-row {
  display: flex;
  gap: 10px;
}

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

.message-row.incoming {
  justify-content: flex-start;
}

.group-avatar {
  width: 32px;
  flex: 0 0 32px;
}

.message-bubble {
  position: relative;
  max-width: min(74%, 680px);
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--bubble-in);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.14);
}

.message-row.outgoing .message-bubble {
  background: var(--bubble-out);
  color: white;
  border-color: rgba(255, 255, 255, 0.14);
}

.message-bubble.photo,
.message-bubble.voice,
.message-bubble.poll,
.message-bubble.bot-card,
.message-bubble.story,
.message-bubble.file {
  padding: 0;
  overflow: hidden;
}

.author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.author-name {
  font-weight: 700;
}

.reply-snippet {
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(255, 255, 255, 0.35);
}

.message-row.outgoing .reply-snippet {
  background: rgba(255, 255, 255, 0.18);
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.5;
  word-break: break-word;
}

.message-meta {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.72);
}

.message-row.incoming .message-meta {
  color: var(--muted);
}

.reactions-bar,
.inline-actions,
.poll-options,
.bot-buttons,
.discover-grid,
.detail-grid,
.media-grid,
.calls-grid,
.stats-row,
.settings-grid,
.theme-choices,
.accent-choices,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reactions-bar {
  margin-top: 10px;
}

.reaction-chip {
  padding: 6px 10px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit;
}

.reaction-chip.mine {
  background: rgba(255, 255, 255, 0.18);
}

.inline-actions {
  margin-top: 10px;
}

.inline-action {
  padding: 8px 12px;
  font-size: 0.76rem;
}

.summary-pill {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.summary-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.media-card,
.file-card,
.voice-card,
.poll-card,
.bot-card-inner,
.story-card {
  padding: 14px;
}

.media-thumb,
.story-thumb,
.details-cover {
  height: 220px;
  border-radius: 0;
  display: flex;
  align-items: end;
  padding: 16px;
  background: linear-gradient(135deg, rgba(52, 164, 255, 0.85), rgba(143, 92, 255, 0.85));
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
}

.media-card .media-caption,
.story-card .story-caption {
  padding-top: 12px;
}

.voice-wave {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 42px;
  margin: 12px 0;
}

.voice-wave span {
  width: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

.message-row.incoming .voice-wave span,
body.light .voice-wave span {
  background: rgba(16, 33, 59, 0.48);
}

.poll-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.poll-progress {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.poll-progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--value, 0) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(52, 164, 255, 0.92), rgba(37, 118, 221, 0.92));
}

.bot-buttons button {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 14px;
  color: white;
}

.bot-buttons button[data-color="blue"] {
  background: linear-gradient(135deg, #34a4ff, #1f76d9);
}

.bot-buttons button[data-color="green"] {
  background: linear-gradient(135deg, #32d296, #0f9f67);
}

.bot-buttons button[data-color="purple"] {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.bot-buttons button[data-color="orange"] {
  background: linear-gradient(135deg, #ffb554, #f97316);
}

.composer-wrap {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.composer-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.composer {
  flex: 1;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.composer textarea {
  resize: none;
  width: 100%;
  max-height: 140px;
  min-height: 26px;
  line-height: 1.45;
}

.details-panel {
  padding: 0;
}

.details-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.details-body {
  padding: 18px 20px 20px;
}

.details-profile {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.details-cover {
  height: 154px;
  border-radius: 22px;
}

.details-avatar {
  width: 72px;
  height: 72px;
  border-radius: 26px;
  font-size: 1.4rem;
}

.detail-grid,
.settings-grid {
  display: grid;
  gap: 12px;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.detail-card,
.settings-card,
.call-card,
.discover-card {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-card.full,
.settings-card,
.call-card,
.discover-card {
  grid-column: 1 / -1;
}

.stats-row {
  margin-top: 12px;
}

.media-grid {
  margin-top: 12px;
}

.media-grid .media-mini {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  height: 96px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(52, 164, 255, 0.3), rgba(143, 92, 255, 0.26));
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
}

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

.quick-actions .soft-button {
  flex: 1 1 calc(50% - 4px);
  justify-content: flex-start;
}

.calls-content,
.discover-content {
  min-height: 0;
  padding: 18px;
}

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

.call-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

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

.discover-card h3,
.call-card h3,
.detail-card h3,
.settings-card h3 {
  margin-bottom: 10px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(7, 10, 18, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-card,
.story-modal,
.settings-modal {
  width: min(720px, calc(100vw - 32px));
}

.auth-card {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.auth-hero,
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label,
.settings-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form input {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.story-modal {
  min-height: 70vh;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
}

.story-screen {
  min-height: 62vh;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(52, 164, 255, 0.85), rgba(143, 92, 255, 0.88));
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.story-top,
.story-bottom {
  padding: 18px;
}

.story-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.story-progress span {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.story-progress span.active {
  background: white;
}

.settings-modal {
  position: relative;
  padding: 22px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.theme-choice,
.accent-choice {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.theme-choice.active,
.accent-choice.active {
  outline: 2px solid rgba(52, 164, 255, 0.44);
}

.toggle-row {
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.mobile-nav {
  display: none;
}

.system-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

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

.message-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.message-row.outgoing .message-tag {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 1480px) {
  .app-shell {
    grid-template-columns: 98px 340px minmax(420px, 1fr) 300px;
  }
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 92px 320px minmax(420px, 1fr);
  }

  .details-panel {
    display: none;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    margin: 8px auto;
    gap: 10px;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .nav-rail,
  .details-panel {
    display: none;
  }

  .chats-panel,
  .main-stack,
  .chat-panel,
  .alt-view {
    grid-column: 1;
    grid-row: 1;
  }

  .chats-panel {
    z-index: 1;
  }

  .chat-panel,
  .alt-view {
    z-index: 2;
  }

  .app-shell[data-mobile-view="list"] .main-stack {
    display: none;
  }

  .app-shell[data-mobile-view="content"] .chats-panel {
    display: none;
  }

  .mobile-nav {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    padding: 10px;
    justify-content: space-between;
  }

  .mobile-tab {
    flex-direction: column;
    gap: 4px;
    font-size: 0.76rem;
    padding: 10px;
  }

  .chat-panel,
  .alt-view {
    position: relative;
    inset: auto;
    min-height: 0;
  }

  .message-bubble {
    max-width: 86%;
  }

  .calls-grid,
  .discover-grid,
  .settings-grid,
  .detail-grid,
  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 20px;
  }

  .story-modal,
  .settings-modal {
    width: calc(100vw - 16px);
  }
}

@media (max-width: 680px) {
  .panel-header,
  .search-block,
  .folder-row,
  .composer-wrap,
  .calls-content,
  .discover-content,
  .details-body,
  .details-head {
    padding-left: 14px;
    padding-right: 14px;
  }

  .message-list {
    padding: 14px;
  }

  .composer-wrap {
    gap: 8px;
  }

  .composer-tools {
    flex-direction: column;
  }

  .composer {
    padding: 10px;
  }

  .chat-header-actions {
    gap: 6px;
  }

  .brand-block h1,
  .panel-header h2,
  .auth-card h2 {
    font-size: 1.3rem;
  }
}

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