:root {
  --ink-900: #14263f;
  --ink-700: #304a6b;
  --ink-500: #607a9c;
  --sky-50: #f8fbff;
  --sky-100: #ecf3ff;
  --sky-200: #d9e8ff;
  --sky-400: #3f7fda;
  --sky-600: #2058ad;
  --sun: #f4a227;
  --mint: #1f8a6a;
  --danger: #b13a3a;
  --card: rgba(255, 255, 255, 0.88);
  --line: #d3e0f3;
  --shadow: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(42rem 24rem at -5% -15%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, #edf4ff 0%, #dfebff 45%, #d5e4fc 100%);
}

.hidden { display: none !important; }

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

.page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 18px;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

.card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.hero-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.48);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sky-600);
}

.brand span { color: var(--sun); }

.hero-panel h1 {
  margin: 14px 0 8px;
  font-size: 2.1rem;
  line-height: 1.1;
}

.hero-panel p {
  margin: 0;
  color: var(--ink-700);
  line-height: 1.6;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
.messages-group {
  padding-top: 8px;
}

  margin-top: 14px;
}

.badge-chip {
  border: 1px solid #c5d9f7;
  color: #245086;
  background: #f2f7ff;
  padding: 5px 10px;

.messages-group-title {
  margin-bottom: 10px;
}
  border-radius: 999px;
  font-size: 0.8rem;
}

.auth-panel {
  padding: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
  background: #edf4ff;
  border: 1px solid #d8e5f7;
  border-radius: 12px;

.conversation-row.pinned {
  background: #efefef;
}

.conversation-row.system-chat {
  border-left: 2px solid #222;
}

.conversation-row.system-chat .conversation-name::before {
  content: "● ";
  opacity: 0.75;
}
  padding: 6px;
  margin-bottom: 14px;
}

.segment button {
  border: 0;
  background: transparent;
  color: #2f578f;
  border-radius: 9px;
  padding: 8px;
  font-weight: 600;
  cursor: pointer;
}

.segment button.active {
  background: #fff;
  box-shadow: 0 5px 14px rgba(28, 79, 156, 0.14);
}

.form-pane { display: none; }
.form-pane.active { display: block; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-700);
  margin-bottom: 5px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #c8d9f2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 11px;
  color: var(--ink-900);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #7ea7e3;
  box-shadow: 0 0 0 3px rgba(63, 127, 218, 0.16);
}

.field textarea { min-height: 88px; resize: vertical; }

.btn {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 700;
}

.btn.primary {
  background: linear-gradient(120deg, #2259ac, #163e7d);
  color: #fff;
}

.btn.secondary {
  border: 1px solid #c8d9f2;
  color: #275286;
  background: #f4f8ff;
}

.btn.danger {
  background: #fce8e8;
  color: var(--danger);
  border: 1px solid #f1caca;
}

.status {
  display: none;
  margin-top: 10px;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.status.ok { display: block; background: #e7f7ef; color: #155f46; }
.status.err { display: block; background: #fdeaea; color: #a23333; }
.status.warn { display: block; background: #fff4dd; color: #8d5c00; }

.app-shell {
  display: none;
  border-radius: 0;
  overflow: visible;
}
.app-shell.show { display: block; }

.app-header {
  background: linear-gradient(135deg, #173f7f, #2b66ba);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-mini {
  font-size: 0.88rem;
  opacity: 0.92;
}

.layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 72vh;
  gap: 14px;
}

.sidebar {
  border-right: none;
  background: transparent;
  padding: 12px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  border: none;
  border-left: 3px solid transparent;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 0;
  padding: 10px 11px;
  cursor: pointer;
  color: #2e4f79;
  font-weight: 600;
}

.nav-btn.active {
  background: rgba(32, 88, 173, 0.12);
  color: #1f56a8;
  border-left-color: #1f56a8;
}

.content {
  padding: 6px 0 14px;
  display: grid;
  gap: 10px;
}

.view { display: none; }
.view.active {
  display: block;
  background: rgba(255, 255, 255, 0.5);
  padding: 12px 14px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #1f4779;
  font-weight: 700;
}

.row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.filter-row {
  margin: 4px 0 10px;
}

.chip {
  border: 1px solid #cadef8;
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.84);
  color: #315f95;
  font-weight: 700;
  cursor: pointer;
}

.chip.active {
  background: #1f56a8;
  color: #fff;
  border-color: #1f56a8;
}

.feed-list,
.flight-list,
.chat-list,
.user-list {
  display: grid;
  gap: 10px;
}

.messages-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 12px;
  min-height: 62vh;
  background: rgba(255, 255, 255, 0.45);
}

.messages-sidebar-panel,
.message-thread-panel {
  padding: 0;
  overflow: hidden;
}

.messages-panel-head,
.message-thread-head {
  padding: 14px;
  border-bottom: 1px solid #d8e6f8;
  background: rgba(255, 255, 255, 0.72);
}

.messages-panel-head h4,
.message-thread-head h4 {
  margin: 0 0 4px;
}

.messages-group {
  padding: 12px 12px 0;
}

.messages-group:last-child {
  padding-bottom: 12px;
}

.messages-group-title {
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5e7da6;
}

.messages-scroll {
  max-height: calc(62vh - 62px);
  overflow: auto;
}

.conversation-list {
  display: grid;
  gap: 0;
}

.conversation-row {
  border: none;
  border-bottom: 1px solid #d8e6f8;
  border-radius: 0;
  background: transparent;
  padding: 10px 11px;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.conversation-row:hover {
  border-color: #9ebef1;
  box-shadow: none;
}

.conversation-row.active {
  border-color: #1f56a8;
  background: rgba(31, 86, 168, 0.08);
}

.conversation-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.conversation-name {
  font-weight: 700;
  color: #244d81;
}

.conversation-preview {
  color: #587396;
  font-size: 0.84rem;
  line-height: 1.45;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #1f56a8;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
}

.pill.warn {
  background: #f4a227;
  color: #142d4b;
}

.message-thread-panel {
  display: flex;
  flex-direction: column;
  min-height: 62vh;
}

.message-thread-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 62vh;
  padding: 24px;
  text-align: center;
}

.message-thread-view {
  display: flex;
  flex-direction: column;
  min-height: 62vh;
}

.mobile-thread-back {
  display: none;
}

.message-thread-list {
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: rgba(247, 251, 255, 0.72);
  display: grid;
  gap: 10px;
}

.bubble {
  max-width: min(82%, 580px);
  padding: 11px 12px;
  border-radius: 10px;
  line-height: 1.5;
  box-shadow: none;
}

.bubble.incoming {
  justify-self: start;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dbe8f9;
}

.bubble.outgoing {
  justify-self: end;
  background: linear-gradient(135deg, #2459ab, #173f7f);
  color: #fff;
}

.bubble-meta {
  margin-top: 6px;
  font-size: 0.76rem;
  opacity: 0.76;
}

.message-compose-form {
  border-top: 1px solid #d8e6f8;
  padding: 12px 14px 14px;
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.message-compose-form textarea {
  min-height: 80px;
}

.item {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 12px 0;
  box-shadow: none;
  border-bottom: 1px solid var(--line);
}

.item h4 {
  margin: 0 0 6px;
  color: #244d81;
  font-size: 0.94rem;
}

.feed-list {
  grid-template-columns: 1fr;
}

.feed-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.feed-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(145deg, #dbe9ff, #c6dbfc);
  color: #17417b;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
}

#view-post-detail .item,
#view-user-profile .item,
#view-user-list .item {
  border-bottom: 1px solid var(--line);
}

.feed-card-body {
  min-width: 0;
}

.feed-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.feed-card-mainline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.feed-author {
  font-weight: 700;
  color: #203f68;
}

.feed-time {
  font-size: 0.8rem;
  color: #5f7ea5;
  white-space: nowrap;
}

.feed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.feed-badge.pilot {
  background: #e7f7ef;
  color: #155f46;
}

.feed-badge.flight {
  background: #e9f0ff;
  color: #1f56a8;
}

.feed-content {
  margin-top: 6px;
  line-height: 1.55;
  color: #203f68;
  word-break: break-word;
}

.feed-card-foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #1e4a82;
  background: #dbe9ff;
  border: 1px solid #bfd6f8;
}

.avatar.avatar-lg {
  width: 56px;
  height: 56px;
  margin-right: 8px;
}

.profile-head-row {
  justify-content: space-between;
  align-items: center;
}

.profile-identity {
  align-items: center;
}

.profile-settings-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.meta {
  color: #5f799c;
  font-size: 0.83rem;
}

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

.stat {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 10px;
  box-shadow: none;
}

.stat .label { color: #6380a5; font-size: 0.78rem; }
.stat .value { font-size: 1.15rem; font-weight: 700; margin-top: 3px; }

.bottom-nav {
  display: none;
}

@media (min-width: 1200px) and (orientation: landscape) {
  .page-wrap {
    max-width: 1460px;
    padding: 18px 24px;
  }

  .auth-layout {
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    min-height: calc(100vh - 36px);
  }

  .hero-panel,
  .auth-panel {
    min-height: calc(100vh - 36px);
  }

  .layout {
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 108px);
  }

  .sidebar {
    padding: 14px;
  }

  .nav-btn {
    padding: 11px 12px;
    font-size: 0.92rem;
  }

  .content {
    padding: 16px;
    gap: 14px;
  }

  .feed-list,
  .flight-list,
  .chat-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .messages-shell {
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
    min-height: calc(100vh - 220px);
  }

  .messages-scroll,
  .message-thread-panel,
  .message-thread-view,
  .message-thread-empty {
    min-height: calc(100vh - 260px);
  }

  .item,
  .card {
    border-radius: 0;
  }
}

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page-wrap {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .content {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }
  .bottom-nav {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    border-top: 1px solid var(--line);
    background: #fff;
    position: fixed !important;
    inset: auto 0 0 0;
    width: 100vw;
    max-width: 100vw;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    z-index: 9999;
    box-shadow: 0 -10px 26px rgba(20, 52, 101, 0.12);
  }
  .app-shell.show + .bottom-nav {
    display: grid;
  }
  .bottom-nav button {
    border: none;
    border-radius: 8px;
    background: rgba(248, 251, 255, 0.92);
    color: #2e4f79;
    padding: 8px 4px;
    font-size: 0.76rem;
    font-weight: 700;
  }
  .bottom-nav button.active {
    background: #1f56a8;
    color: #fff;
    border-color: #1f56a8;
  }
  .messages-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .messages-shell.thread-open #messages-sidebar-panel {
    display: none;
  }
  .messages-shell.thread-open #message-thread-panel {
    display: flex;
  }
  .messages-shell:not(.thread-open) #message-thread-panel {
    display: none;
  }
  .messages-scroll,
  .message-thread-list {
    max-height: none;
  }
  .message-thread-panel,
  .message-thread-view,
  .message-thread-empty {
    min-height: calc(100vh - 240px);
  }
  .mobile-thread-back {
    display: inline-flex;
  }
  .message-compose-form {
    grid-template-columns: 1fr;
  }
  .stat-grid { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Mobile app redesign overrides: monochrome + flat minimal UI */
:root {
  --ink-900: #0f0f0f;
  --ink-700: #292929;
  --ink-500: #5c5c5c;
  --sky-50: #f5f5f5;
  --sky-100: #efefef;
  --sky-200: #dfdfdf;
  --sky-400: #7a7a7a;
  --sky-600: #111111;
  --sun: #111111;
  --mint: #1d1d1d;
  --danger: #9b1c1c;
  --card: #ffffff;
  --line: #e8e8e8;
}

html,
body {
  color: var(--ink-900);
  background: #ffffff;
}

.page-wrap {
  max-width: 560px;
  padding: 0 12px calc(94px + env(safe-area-inset-bottom));
}

.auth-layout,
.layout,
.messages-shell,
.grid-2 {
  grid-template-columns: 1fr;
}

.hero-panel {
  display: none;
}

.auth-panel,
.view,
.item,
.stat,
.conversation-row,
.message-thread-head,
.messages-panel-head,
.message-compose-form,
.segment {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}

.item,
.stat,
.conversation-row {
  padding: 12px;
}

.feed-card,
.profile-head-row,
.profile-settings-head {
  gap: 10px;
}

.brand,
.section-title,
.feed-author,
.item h4,
.conversation-name {
  color: #101010;
}

.hero-panel p,
.meta,
.feed-time,
.conversation-preview,
.bubble-meta {
  color: #5e5e5e;
}

.badge-chip,
.chip,
.btn.secondary,
.bottom-nav button,
.feed-badge.flight,
.feed-badge.pilot,
.pill.warn {
  color: #111111;
  border: 1px solid #d8d8d8;
  background: #f7f7f7;
}

.chip.active,
.nav-btn.active,
.bottom-nav button.active,
.pill,
.btn.primary,
.bubble.outgoing {
  color: #ffffff;
  border: 1px solid #111111;
  background: #111111;
}

.nav-btn,
.segment button,
.conversation-row,
.bubble.incoming,
.feed-card-avatar,
.avatar,
.stat {
  border: 1px solid #e3e3e3;
  background: #ffffff;
  color: #101010;
}

.feed-card-avatar,
.avatar {
  border-radius: 999px;
}

.app-shell,
.sidebar {
  display: block;
}

.sidebar {
  display: none;
}

.content {
  gap: 12px;
  padding: 10px 0 2px;
}

.view {
  padding: 10px;
}

.messages-shell {
  min-height: auto;
  background: transparent;
}

.messages-scroll,
.message-thread-list {
  max-height: none;
}

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

.message-thread-panel,
.message-thread-view,
.message-thread-empty {
  min-height: calc(100vh - 250px);
}

.mobile-thread-back {
  display: inline-flex;
}

.bottom-nav {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  position: fixed !important;
  inset: auto 0 0 0;
  width: 100vw;
  max-width: 100vw;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  z-index: 9999;
  box-shadow: none;
}

.app-shell.show + .bottom-nav {
  display: grid;
}

.bottom-nav button {
  border-radius: 10px;
  padding: 9px 4px;
  font-size: 0.74rem;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  border: 1px solid #dbdbdb;
  border-radius: 10px;
  background: #ffffff;
  color: #111111;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #111111;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.08);
}

.messages-shell.thread-open #messages-sidebar-panel {
  display: none;
}

.messages-shell.thread-open #message-thread-panel {
  display: flex;
}

.messages-shell:not(.thread-open) #message-thread-panel {
  display: none;
}

@media (min-width: 981px) {
  .page-wrap {
    max-width: 560px;
  }

  .bottom-nav {
    display: none;
  }

  .app-shell.show + .bottom-nav {
    display: grid;
  }
}

.btn,
.chip,
.nav-btn,
.conversation-row,
.bottom-nav button {
  transition: transform 120ms ease, background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn:active,
.chip:active,
.nav-btn:active,
.conversation-row:active,
.bottom-nav button:active {
  transform: scale(0.98);
}

.load-sentinel {
  height: 26px;
}

.skeleton-card {
  border-color: #ededed;
  background: #fcfcfc;
}

.skeleton-line {
  height: 10px;
  border-radius: 8px;
  margin-top: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
  background-size: 320% 100%;
  animation: shimmer 1.1s linear infinite;
}

.skeleton-line.lg {
  width: 55%;
  height: 13px;
  margin-top: 0;
}

.message-compose-form.is-sending {
  opacity: 0.72;
  pointer-events: none;
}

body.keyboard-open .bottom-nav {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

body.keyboard-open .content {
  padding-bottom: 12px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* Batch 1: contemporary polish (less borders, better buttons) */
:root {
  --surface-0: #ffffff;
  --surface-1: #fbfbfb;
  --surface-2: #f4f4f4;
  --ink-1: #101010;
  --ink-2: #3d3d3d;
  --ink-3: #747474;
}

html,
body {
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.view,
.item,
.stat,
.auth-panel,
.message-thread-head,
.messages-panel-head,
.message-compose-form,
.segment {
  border: none;
  background: var(--surface-0);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(10, 10, 10, 0.04), 0 8px 24px rgba(10, 10, 10, 0.03);
}

.item,
.conversation-row,
.stat {
  border: none;
}

.feed-list .item,
.flight-list .item,
.conversation-list .item {
  margin-bottom: 8px;
}

.meta,
.feed-time,
.conversation-preview,
.bubble-meta {
  color: var(--ink-3);
}

.section-title,
.feed-author,
.conversation-name,
.item h4 {
  color: var(--ink-1);
}

.btn {
  min-height: 44px;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn.primary {
  border: none;
  background: #111111;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.btn.secondary {
  border: none;
  background: #f3f3f3;
  color: #1a1a1a;
}

.btn.danger {
  border: none;
  background: #1a1a1a;
  color: #ffffff;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  box-shadow: none;
}

.btn.primary:active,
.btn.secondary:active,
.btn.danger:active {
  transform: translateY(1px) scale(0.985);
}

.chip,
.badge-chip {
  border: none;
  background: #f2f2f2;
  color: #262626;
  border-radius: 999px;
  padding: 8px 12px;
}

.chip.active {
  background: #111111;
  color: #ffffff;
}

.segment {
  background: #f6f6f6;
  padding: 5px;
}

.segment button {
  border: none;
  background: transparent;
  color: #444444;
}

.segment button.active {
  background: #ffffff;
  color: #111111;
  box-shadow: 0 2px 10px rgba(10, 10, 10, 0.08);
}

.bottom-nav {
  border-top: none;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.bottom-nav button {
  border: none;
  background: transparent;
  color: #616161;
  min-height: 42px;
}

.bottom-nav button.active {
  background: #111111;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.status {
  border: none;
  border-radius: 12px;
  background: #f3f3f3;
  color: #202020;
}

/* Batch 2: full-app consistency for spacing, hierarchy, and modern rhythm */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

body {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
}

.page-wrap {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.auth-layout {
  gap: var(--space-4);
}

.auth-panel {
  padding: var(--space-4);
}

.form-pane .field {
  margin-bottom: var(--space-3);
}

.field label {
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #666666;
}

.field input,
.field textarea,
.field select {
  min-height: 44px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
}

.field textarea {
  min-height: 96px;
}

.content {
  gap: var(--space-4);
}

.view {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}

.section-title {
  margin: 0 0 var(--space-3);
  font-size: 1.06rem;
  letter-spacing: 0.01em;
}

.row {
  gap: var(--space-2);
}

.filter-row {
  margin: 0 0 var(--space-3);
}

.item {
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

.feed-list,
.flight-list,
.conversation-list,
.message-thread-list,
#profile-list,
#user-list-box {
  gap: var(--space-3);
}

.feed-card {
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--space-3);
}

.feed-card-avatar,
.avatar {
  width: 40px;
  height: 40px;
  font-size: 0.84rem;
}

.avatar.avatar-lg {
  width: 52px;
  height: 52px;
}

.feed-card-head {
  align-items: flex-start;
}

.feed-content {
  margin-top: var(--space-2);
  line-height: 1.6;
  color: #1f1f1f;
}

.feed-card-foot {
  margin-top: var(--space-3);
}

.messages-shell,
.message-thread-panel,
.messages-sidebar-panel {
  gap: var(--space-3);
  border-radius: var(--radius-lg);
}

.messages-group {
  padding: var(--space-3) var(--space-3) 0;
}

.messages-group-title {
  margin-bottom: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #7a7a7a;
}

.conversation-row {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.conversation-row.active {
  background: #f1f1f1;
}

.message-thread-list {
  padding: var(--space-3);
}

.bubble {
  border-radius: 12px;
  padding: 10px 12px;
}

.bubble.incoming {
  background: #f3f3f3;
  border: none;
}

.message-compose-form {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--space-3);
  border-radius: var(--radius-md);
}

.stat-grid {
  gap: var(--space-2);
}

.stat {
  padding: var(--space-3);
  background: #f8f8f8;
}

.stat .label {
  font-size: 0.73rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat .value {
  margin-top: 2px;
  font-size: 1.05rem;
}

.profile-settings-head h4,
#profile-list-title,
#user-list-title {
  letter-spacing: 0.01em;
}

.status.ok,
.status.warn,
.status.err {
  border-left: 3px solid #111111;
}

@media (max-width: 980px) {
  .page-wrap {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .content {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

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

/* Batch 3: navigation polish, cohesive motion, and final cleanup */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.5;
}

body::before {
  width: 220px;
  height: 220px;
  top: -80px;
  right: -70px;
  background: rgba(0, 0, 0, 0.06);
}

body::after {
  width: 200px;
  height: 200px;
  left: -80px;
  bottom: 80px;
  background: rgba(0, 0, 0, 0.04);
}

.view {
  position: relative;
  overflow: clip;
}

.view.active {
  animation: view-in 220ms cubic-bezier(0.2, 0.75, 0.3, 1) both;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  font-size: 1.1rem;
  font-weight: 800;
}

.section-title::after {
  content: none;
}

.filter-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.chip {
  white-space: nowrap;
  padding: 8px 13px;
  font-weight: 700;
}

.conversation-row,
.feed-card,
.flight-list > .item,
#profile-list > .item,
#user-list-box > .item,
.messages-group > .conversation-list > * {
  animation: lift-in 260ms cubic-bezier(0.2, 0.75, 0.3, 1) both;
}

.feed-list > *:nth-child(1),
.flight-list > *:nth-child(1),
.conversation-list > *:nth-child(1) { animation-delay: 20ms; }
.feed-list > *:nth-child(2),
.flight-list > *:nth-child(2),
.conversation-list > *:nth-child(2) { animation-delay: 45ms; }
.feed-list > *:nth-child(3),
.flight-list > *:nth-child(3),
.conversation-list > *:nth-child(3) { animation-delay: 70ms; }
.feed-list > *:nth-child(4),
.flight-list > *:nth-child(4),
.conversation-list > *:nth-child(4) { animation-delay: 95ms; }

.message-thread-head,
.messages-panel-head {
  position: sticky;
  top: 0;
  z-index: 3;
  backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, 0.84);
}

.message-thread-list {
  scroll-behavior: smooth;
}

.bubble {
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.field input,
.field textarea,
.field select {
  background: #fcfcfc;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9a9a9a;
}

.bottom-nav {
  border-radius: 18px 18px 0 0;
  margin: 0 8px;
  width: calc(100vw - 16px);
  left: 8px;
  right: 8px;
}

.bottom-nav button {
  border-radius: 12px;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}

.bottom-nav button.active {
  transform: translateY(-1px);
}

.status {
  font-size: 0.82rem;
}

.skeleton-line {
  border-radius: 999px;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view.active,
  .conversation-row,
  .feed-card,
  .flight-list > .item,
  #profile-list > .item,
  #user-list-box > .item,
  .messages-group > .conversation-list > * {
    animation: none !important;
  }

  .btn,
  .chip,
  .nav-btn,
  .conversation-row,
  .bottom-nav button,
  .bubble {
    transition: none !important;
  }
}

/* Shared utility classes for cross-page consistency */
.row-between {
  justify-content: space-between;
}

.row-center {
  align-items: center;
}

.stack-top-xs {
  margin-top: 6px;
}

.stack-top-sm {
  margin-top: 8px;
}

.stack-top {
  margin-top: 10px;
}

.title-tight {
  margin: 0;
}

.field-tight {
  margin: 0;
}

.select-compact {
  max-width: 180px;
}

.btn.loading {
  position: relative;
  opacity: 0.86;
}

.btn.loading::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

.empty-state {
  text-align: left;
  background: linear-gradient(180deg, #fafafa 0%, #f6f6f6 100%);
  border: 1px dashed #e6e6e6;
  box-shadow: none;
}

.empty-state h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.empty-state .meta {
  line-height: 1.5;
  max-width: 36ch;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#view-home .section-title,
#view-flights .section-title,
#view-messages .section-title,
#view-profile .section-title,
#view-post-detail .section-title,
#view-user-profile .section-title,
#view-user-list .section-title {
  margin-bottom: var(--space-3);
}

#home-compose-box,
#profile-main-page > .item,
#profile-settings-page .item,
#flights-mine-block > .item,
#flights-board-block > .item,
#other-user-card,
#post-detail-main,
#user-list-box > .item {
  border-radius: var(--radius-md);
}

#profile-visibility {
  min-height: 40px;
}

@media (max-width: 980px) {
  .select-compact {
    max-width: 160px;
  }
}

/* Message page final overrides */
#view-messages .conversation-row.pinned {
  background: #ececec;
}

#view-messages .conversation-row.system-chat {
  border-left: none;
}

#view-messages .conversation-row.system-chat .conversation-name::before {
  content: none;
}

#view-messages .messages-panel-head {
  display: none;
}

#view-messages .messages-group {
  padding-top: 0;
}

#view-messages #messages-sidebar-panel {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

#view-messages #messages-shell {
  background: transparent;
}

#view-home .section-title,
#view-flights .section-title,
#view-messages .section-title,
#view-profile .section-title {
  justify-content: center;
  text-align: center;
}

#view-messages .conversation-row {
  background: #f8f8f8;
}

#view-messages .conversation-row:hover {
  background: #f2f2f2;
}

#view-messages .conversation-row.active {
  background: #ededed;
}

#view-messages .thread-actions-wrap {
  position: relative;
}

#view-messages #mobile-thread-back,
#view-messages #thread-more-toggle {
  min-width: 34px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
}

#view-messages .thread-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 148px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e8e8e8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 20;
}

#view-messages .thread-more-menu .btn.secondary {
  width: 100%;
  justify-content: flex-start;
}

#view-messages .message-thread-head .btn.secondary:disabled {
  opacity: 0.42;
  background: #f0f0f0;
  color: #7d7d7d;
}

/* Message thread redesign - batch 1 */
#view-messages #message-thread-panel {
  border: none;
  background: transparent;
  box-shadow: none;
}

#view-messages .message-thread-head {
  padding: 8px 2px 10px;
  border-bottom: none;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#view-messages .message-thread-head h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

#view-messages #thread-meta {
  margin-top: 2px;
  font-size: 0.74rem;
}

#view-messages .message-thread-list {
  background: #f7f7f7;
  border: none;
  border-radius: 14px;
  padding: 12px;
  gap: 7px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

#view-messages .bubble {
  max-width: min(80%, 520px);
  padding: 9px 11px;
  border-radius: 14px;
  line-height: 1.45;
  word-break: break-word;
}

#view-messages .bubble.continued {
  margin-top: -2px;
}

#view-messages .bubble.middle {
  margin-bottom: 2px;
}

#view-messages .bubble.incoming {
  background: #ececec;
  border: none;
  justify-self: start;
  border-bottom-left-radius: 8px;
}

#view-messages .bubble.outgoing {
  background: #1a1a1a;
  color: #fff;
  justify-self: end;
  border-bottom-right-radius: 8px;
}

#view-messages .bubble-meta {
  margin-top: 5px;
  font-size: 0.7rem;
  opacity: 0.64;
}

#view-messages .thread-empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
  min-height: 42vh;
  color: #666;
}

#view-messages .thread-empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2c2c2c;
}

#view-messages .thread-empty-meta {
  margin-top: 4px;
  font-size: 0.76rem;
}

#view-messages .thread-enter {
  animation: thread-message-in 160ms ease both;
}

@keyframes thread-message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#view-messages .message-compose-form {
  border-top: none;
  padding: 10px 0 0;
  background: transparent;
  align-items: end;
  gap: 8px;
}

#view-messages .message-compose-form .field {
  margin: 0;
}

#view-messages #message-compose-input {
  min-height: 46px;
  max-height: 140px;
  border-radius: 14px;
  padding: 11px 12px;
  background: #f3f3f3;
  border: none;
}

#view-messages .message-compose-form .btn.primary {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 16px;
}

@media (max-width: 980px) {
  #view-messages .message-thread-head {
    padding-top: 4px;
  }

  #view-messages .message-thread-list {
    border-radius: 12px;
  }
}
