/* Carrier layout, components, parchment, map filter */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overscroll-behavior: none;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--on-background);
  background-color: var(--parchment);
  background-image:
    radial-gradient(ellipse at top right, rgba(14, 165, 233, 0.06), transparent 46%),
    radial-gradient(ellipse at bottom left, rgba(0, 108, 73, 0.05), transparent 42%),
    var(--paper-noise);
  overflow: hidden;
}

img,
svg {
  max-width: 100%;
  display: block;
}

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

button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
}

.icon-fill {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

noscript {
  display: block;
  padding: 16px var(--margin);
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--surface-container-highest);
  font-family: var(--font-message);
}

/* Typography */
.t-display {
  font-family: var(--font-ui);
  font-size: var(--fs-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.t-headline-lg {
  font-size: var(--fs-headline-lg);
  font-weight: 700;
  line-height: 1.2;
}

.t-headline-md {
  font-size: var(--fs-headline-md);
  font-weight: 600;
  line-height: 1.3;
}

.t-headline-sm {
  font-size: var(--fs-headline-sm);
  font-weight: 600;
  line-height: 1.4;
}

.t-message {
  font-family: var(--font-message);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
}

.t-label {
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: 1.2;
}

.t-label-sm {
  font-size: var(--fs-label-sm);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 400;
  line-height: 1.2;
}

/* App chrome — pinned to the visual viewport so the composer tracks the keyboard */
.app,
.auth-root,
.docs-root,
.boot {
  position: fixed;
  top: var(--vv-offset, 0px);
  left: 0;
  right: 0;
  height: var(--app-height, 100dvh);
  min-height: 0;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  z-index: 0;
  isolation: isolate;
}

.topbar {
  position: relative;
  z-index: var(--z-chrome);
  flex-shrink: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 var(--margin);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  color: var(--primary);
}

.topbar--desktop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
  color: var(--primary);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.8;
}

.brand__mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand__title {
  margin: 0;
  font-size: var(--fs-headline-md);
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-alias {
  min-width: 0;
  max-width: 38%;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--secondary-container) 70%, var(--surface));
  color: var(--on-secondary-container);
  text-decoration: none;
  line-height: 1;
}

.topbar-alias:hover {
  text-decoration: none;
  opacity: 0.85;
}

.topbar-alias__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  opacity: 0.75;
  flex-shrink: 0;
  position: relative;
  top: 0.5px;
}

.topbar-alias__name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-alias:not([hidden]) + .topbar__actions {
  margin-left: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
}

.icon-btn:hover {
  background: color-mix(in srgb, var(--surface-variant) 50%, transparent);
  color: var(--primary);
}

.icon-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desktop-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--on-surface-variant);
  font-size: var(--fs-label);
  font-weight: 600;
  text-decoration: none;
}

.desktop-nav a:hover {
  background: color-mix(in srgb, var(--surface-variant) 50%, transparent);
  color: var(--primary);
}

.desktop-nav a.is-active {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.views {
  flex: 1;
  position: relative;
  z-index: var(--z-view);
  min-height: 0;
  overflow: hidden;
}

body[data-view="auth"] .views,
body[data-view="boot"] .views {
  margin-top: 0;
}

.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.view--fill {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.page {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: var(--space-lg) var(--margin) 24px;
}

.page--wide {
  max-width: 1024px;
}

.bottom-nav {
  position: relative;
  z-index: var(--z-chrome);
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-nav);
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  border-radius: 16px 16px 0 0;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 18px;
  border-radius: var(--radius-full);
  color: var(--on-surface-variant);
  text-decoration: none;
  font-size: var(--fs-label-sm);
  font-weight: 500;
}

.bottom-nav a .nav-glyph {
  width: 22px;
  height: 22px;
  object-fit: contain;
  margin-bottom: 2px;
  filter: grayscale(0.4);
  opacity: 0.85;
}

.bottom-nav a.is-active {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.bottom-nav a.is-active .nav-glyph {
  filter: none;
  opacity: 1;
}

body[data-view="auth"] .topbar,
body[data-view="auth"] .bottom-nav,
body[data-view="boot"] .topbar,
body[data-view="boot"] .bottom-nav,
body[data-view="chat"] .bottom-nav,
body[data-chrome="immersive"] .bottom-nav {
  display: none;
}

html.is-keyboard .bottom-nav {
  display: none;
}

body[data-view="atlas"] .page {
  padding-bottom: 0;
}

/* Buttons & fields */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: var(--fs-label);
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 2px 8px rgba(0, 101, 145, 0.2);
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
}

.btn--secondary {
  background: var(--secondary);
  color: var(--on-secondary);
}

.btn--ghost {
  background: var(--surface-container);
  color: var(--on-surface);
  border-color: color-mix(in srgb, var(--outline-variant) 50%, transparent);
}

.btn--danger {
  background: var(--error-container);
  color: var(--on-error-container);
}

.btn--tertiary {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: var(--fs-label-sm);
  font-weight: 600;
  color: var(--on-surface-variant);
}

.field input,
.field textarea,
.field select,
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 70%, transparent);
  background: var(--surface);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  caret-color: var(--primary);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
  font-family: var(--font-message);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.input:focus {
  border-color: var(--primary);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02), 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.search {
  position: relative;
}

.search .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--outline);
  pointer-events: none;
}

.search input {
  padding-left: 42px;
}

.paper,
.paper-texture {
  background-color: var(--surface-container-lowest);
  background-image: var(--paper-noise);
  border: 1px solid var(--surface-container-highest);
  box-shadow: var(--shadow-paper);
}

.ink-ring {
  border: 2px solid var(--secondary);
}

/* Boot + Auth */
.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--primary);
}

.boot img {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.auth-root {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--margin);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 22px 24px;
  border-radius: var(--radius-xl);
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--primary-fixed);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

.auth-logo img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.auth-card h1 {
  margin: 0 0 4px;
  text-align: center;
  color: var(--primary);
}

.auth-tag {
  margin: 0 0 24px;
  text-align: center;
  color: var(--on-surface-variant);
  font-family: var(--font-message);
  font-size: 15px;
}

.auth-card .field + .field {
  margin-top: 14px;
}

.auth-card .btn {
  margin-top: 20px;
}

.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--error-container);
  color: var(--on-error-container);
  font-size: var(--fs-label);
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  color: var(--on-surface-variant);
  font-size: var(--fs-label);
}

.auth-remember {
  margin-top: 14px;
  color: var(--on-surface-variant);
}

.auth-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--outline);
  font-size: var(--fs-label-sm);
}

.auth-legal a {
  color: var(--primary);
}

.auth-stack {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 12px;
}

.auth-pitch {
  padding: 20px 18px 18px;
  border-radius: var(--radius-xl);
}

.auth-pitch .docs-kicker {
  margin-bottom: 6px;
}

.auth-pitch h2 {
  margin: 14px 0 6px;
  color: var(--primary);
}

.auth-pitch h2:first-of-type {
  margin-top: 0;
}

.auth-pitch p {
  margin: 0 0 8px;
  font-family: var(--font-message);
  font-size: 15px;
  line-height: 1.55;
  color: var(--on-surface);
}

@media (min-width: 960px) {
  .auth-stack {
    max-width: 880px;
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .auth-pitch {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

.check--wrap {
  align-items: flex-start;
  line-height: 1.4;
  color: var(--on-surface-variant);
}

.check--wrap input {
  margin-top: 2px;
  flex-shrink: 0;
}

.coord-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-container-low);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--outline);
}

/* Roost */
.roost-persona {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 20px;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--surface-container-highest));
  box-shadow: 0 4px 18px rgba(0, 101, 145, 0.06);
}

.roost-persona__who {
  display: flex;
  align-items: center;
  gap: 14px;
}

.roost-persona__copy {
  min-width: 0;
  flex: 1;
}

.roost-persona__kicker {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.roost-persona__copy h2 {
  margin: 0;
  font-size: var(--fs-headline-sm);
  line-height: 1.25;
}

.roost-persona__copy p {
  margin: 4px 0 0;
  color: var(--on-surface-variant);
  font-size: var(--fs-label-sm);
}

.roost-persona__switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.roost-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 60%, transparent);
  background: var(--surface);
  color: var(--on-surface);
  font-size: var(--fs-label-sm);
  font-weight: 600;
}

.roost-chip:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  color: var(--primary);
}

.roost-chip.is-active {
  background: var(--secondary-container);
  border-color: transparent;
  color: var(--on-secondary-container);
}

.roost-chip .avatar,
.roost-chip .avatar-fallback {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.roost-scope-note {
  margin: -4px 0 12px 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary);
}

@media (max-width: 767px) {
  .roost-persona__who,
  .roost-scope-note {
    display: none !important;
  }

  .roost-persona:not(:has(.roost-persona__switch)) {
    display: none !important;
  }

  .roost-persona {
    padding: 10px;
    margin-bottom: 16px;
  }
}

.section-kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  color: var(--outline);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 8px 0 12px 4px;
}

.roost-list,
.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roost-item {
  display: block;
  position: relative;
  overflow: hidden;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
}

.roost-item:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--primary) 30%, var(--surface-container-highest));
}

.roost-item__row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  position: relative;
  z-index: 1;
}

.avatar,
.avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--on-surface-variant);
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.unread-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tertiary-container);
  border: 2px solid var(--surface-container-lowest);
}

.roost-item__main {
  min-width: 0;
  flex: 1;
}

.roost-item__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.roost-item__top h3 {
  margin: 0;
  font-size: var(--fs-label);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roost-item__time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--outline);
}

.roost-item.is-unread .roost-item__time {
  color: var(--tertiary-container);
}

.roost-item__preview {
  margin: 0 0 4px;
  font-family: var(--font-message);
  font-size: 15px;
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roost-item__sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-style: italic;
  color: var(--outline);
  display: flex;
  align-items: center;
  gap: 4px;
}

.roost-item__sub .material-symbols-outlined {
  font-size: 12px;
}

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--on-surface-variant);
}

.empty img {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  object-fit: contain;
  opacity: 0.9;
}

.empty h3 {
  margin: 0 0 8px;
  color: var(--on-surface);
}

.empty p {
  margin: 0;
  font-family: var(--font-message);
}

/* Chat */
.chat-head {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 8px var(--margin);
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--surface-variant);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  flex-shrink: 0;
}

.chat-head .avatar,
.chat-head .avatar-fallback,
.chat-head .avatar-fallback img {
  width: 40px;
  height: 40px;
}

.chat-head__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-head__name {
  font-size: var(--fs-label);
  font-weight: 600;
}

.chat-head__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-label-sm);
  color: var(--outline);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary);
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-lg) var(--margin);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  position: relative;
}

.chat-thread::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: var(--paper-noise);
}

.bubble-row {
  display: flex;
  position: relative;
  z-index: 1;
}

.bubble-row--in {
  justify-content: flex-start;
}

.bubble-row--out {
  justify-content: flex-end;
}

.bubble-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
}

.bubble {
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  position: relative;
  overflow-wrap: anywhere;
}

.bubble--in {
  background: color-mix(in srgb, var(--secondary-fixed) 28%, var(--surface-container-lowest));
  color: var(--on-surface);
  border: 1px solid color-mix(in srgb, var(--secondary) 18%, transparent);
  border-top-left-radius: 6px;
  box-shadow: var(--shadow-paper);
}

.bubble--out {
  background: color-mix(in srgb, var(--primary-fixed) 45%, var(--surface-container-lowest));
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  border-top-right-radius: 6px;
  box-shadow: var(--shadow-paper);
}

.bubble--transit {
  opacity: 0.5;
  background: color-mix(in srgb, var(--surface-container-lowest) 40%, transparent);
  border: 1.5px dashed var(--sky);
  box-shadow: none;
}

.bubble__text {
  margin: 0;
  font-family: var(--font-message);
  font-size: 16px;
  line-height: 1.6;
}

.bubble__text.is-cipher {
  font-family: ui-monospace, "Courier New", "Courier Prime", monospace;
  font-size: 14px;
  letter-spacing: 0.01em;
  min-height: 1.4em;
  word-break: break-word;
}

.bubble__meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bubble__meta > .material-symbols-outlined,
.bubble__meta > span:not(.hub-receipt) {
  opacity: 0.7;
}

.bubble__meta .material-symbols-outlined {
  font-size: 14px;
}

.bubble-docket {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.8;
}

.bubble-docket .material-symbols-outlined {
  font-size: 18px;
}

.bubble-docket:hover,
.bubble-docket:focus-visible {
  opacity: 1;
  background: color-mix(in srgb, var(--on-surface) 8%, transparent);
}

.bubble__from {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hub-receipt {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hub-receipt .material-symbols-outlined {
  font-size: 14px;
  font-variation-settings: "FILL" 1;
}

.delivery-board {
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--outline-variant) 50%, transparent);
  border-radius: var(--radius);
  background: var(--surface-container-lowest);
  overflow: hidden;
}

.delivery-board__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
}

.delivery-board__rows {
  max-height: 220px;
  overflow-y: auto;
}

.delivery-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 8px 12px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 28%, transparent);
}

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

.delivery-who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.delivery-who strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-status {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
}

.delivery-avatar,
.delivery-avatar--fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--on-surface-variant);
}

.delivery-flight {
  min-width: 0;
}

.flight-track--mini {
  height: 18px;
  margin: 0;
}

.flight-track--mini .flight-track__bird {
  width: 16px;
  height: 16px;
}

.delivery-km {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--outline);
}

.delivery-note {
  margin: 4px 0 0;
  font-size: 11px;
  font-style: italic;
  color: var(--tertiary);
}

.bubble-row--out .bubble__meta {
  justify-content: flex-end;
}

.bubble.is-new {
  animation: slide-in-right 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(48px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.flight-card {
  background: var(--surface-container-lowest);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.flight-card__top,
.flight-card__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--outline);
}

.flight-card__top .speed {
  color: var(--tertiary);
}

.flight-track {
  position: relative;
  height: 24px;
  margin: 8px 4px;
}

.flight-track__path {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  border-top: 1.5px dashed var(--secondary);
  opacity: 0.6;
}

.flight-track__fill {
  position: absolute;
  left: 8px;
  top: calc(50% - 1px);
  height: 2px;
  width: 0;
  background: var(--primary);
  border-radius: 99px;
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

.flight-track__bird {
  position: absolute;
  top: 50%;
  left: 8px;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.flight-track__bird img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.flight-note {
  margin: 6px 4px 0;
  font-size: 12px;
  font-style: italic;
  color: var(--tertiary);
}

.stamp {
  align-self: flex-end;
  max-width: 85%;
  padding: 10px 14px;
  border: 2px solid var(--tertiary);
  color: var(--tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  font-size: 12px;
  transform: rotate(-2deg);
  background: color-mix(in srgb, var(--tertiary-fixed) 50%, transparent);
}

.stamp p {
  margin: 6px 0 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-message);
  font-size: 13px;
}

.stamp--intercepted {
  border-color: var(--error);
  color: var(--error);
  background: color-mix(in srgb, var(--error-container) 70%, transparent);
}

.stamp--held {
  border-color: var(--tertiary);
  color: var(--on-tertiary-container);
  background: color-mix(in srgb, var(--tertiary-fixed) 70%, transparent);
}

.roost-item--intercept,
.roost-item--intercept-hot {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.roost-item--intercept-hot {
  border-color: color-mix(in srgb, var(--tertiary) 40%, var(--surface-container-highest));
  box-shadow: 0 4px 16px rgba(216, 138, 0, 0.12);
}

.intercept-letter {
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--secondary-fixed) 22%, var(--surface-container-lowest));
  border: 1px solid color-mix(in srgb, var(--secondary) 16%, transparent);
}

.pin-flight--prey {
  border-color: var(--tertiary);
  border-bottom-color: var(--tertiary-container);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tertiary) 35%, transparent);
}

.pin-flight--pursuit {
  border-color: var(--primary);
  border-bottom-color: var(--burnt);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--burnt) 40%, transparent);
}

.reaction-pill {
  align-self: flex-end;
  margin-top: -4px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 14px;
  box-shadow: var(--shadow-paper);
}

.attach-card,
.link-card {
  margin-top: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  background: var(--surface-container-lowest);
}

.attach-card--photo {
  display: block;
  width: 100%;
}

.attach-card img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.attach-card--photo img {
  pointer-events: none;
}

.attach-card audio {
  width: 100%;
  display: block;
}

.attach-card a {
  display: block;
  padding: 8px 10px;
  font-size: 13px;
}

.link-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.link-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.link-card__body {
  padding: 8px 10px;
}

.link-card__body strong {
  display: block;
  font-size: 13px;
}

.link-card__body p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--on-surface-variant);
}

.decipher {
  margin-top: 2px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-container-lowest);
  border: 1px dashed color-mix(in srgb, var(--primary) 28%, var(--outline-variant));
  box-shadow: var(--shadow-paper);
}

.decipher__kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.decipher__hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--on-surface-variant);
}

.decipher__preview {
  margin-top: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  font-family: var(--font-message);
  font-size: 14px;
  min-height: 2.4em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: min(36vh, 220px);
  overflow-y: auto;
}

.decipher.is-editing .decipher__preview {
  max-height: min(28vh, 180px);
}

.decipher__solved {
  margin: 8px 0 0;
}

.decipher-slot {
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px dashed color-mix(in srgb, var(--primary) 28%, var(--outline-variant));
  background: var(--surface-container-lowest);
  color: var(--on-surface-variant);
  font-size: 13px;
}

.cipher-dock {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 8px var(--margin) calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(20px);
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 25%, transparent);
}

html.is-keyboard .cipher-dock {
  padding-bottom: 10px;
}

.cipher-dock__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.cipher-dock__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.cipher-dock .decipher {
  margin-top: 0;
}

.cipher-dock .decipher__kicker {
  display: none;
}

.cipher-live {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  border: 1px dashed color-mix(in srgb, var(--primary) 28%, var(--outline-variant));
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: min(28vh, 160px);
  overflow-y: auto;
  color: var(--on-surface);
}

.composer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 8px var(--margin) calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(20px);
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 25%, transparent);
}

html.is-keyboard .composer {
  padding-bottom: 10px;
}

html.is-keyboard .composer__tools,
html.is-keyboard #composer-emoji {
  display: none;
}

html.is-cipher-editing .composer {
  display: none;
}

.composer__tools {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
}

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer__box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  background: var(--surface-container-lowest);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
  padding: 6px 8px;
}

.composer__box:focus-within {
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.02), 0 0 0 2px rgba(0, 101, 145, 0.12);
}

.composer__box textarea {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  min-height: 28px;
  max-height: 120px;
  padding: 6px 4px;
  font-family: var(--font-message);
  caret-color: var(--primary);
}

.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 101, 145, 0.25);
  flex-shrink: 0;
}

.btn-send:active {
  transform: scale(0.95);
}

.btn-send:disabled,
.btn-send.is-sending {
  pointer-events: none;
  opacity: 0.72;
  transform: none;
}

.btn-send__spin {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid color-mix(in srgb, var(--on-primary) 35%, transparent);
  border-top-color: var(--on-primary);
  border-radius: 50%;
  animation: send-spin 0.7s linear infinite;
}

.btn-send.is-sending .btn-send__icon {
  display: none;
}

.btn-send.is-sending .btn-send__spin {
  display: block;
}

.composer-sending {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.composer-sending__spin {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: send-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.composer-sending__bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-container-high);
}

.composer-sending__bar > span {
  display: block;
  height: 100%;
  width: 36%;
  border-radius: 99px;
  background: var(--primary);
  animation: send-indeterminate 1.1s ease-in-out infinite;
}

@keyframes send-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes send-indeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.composer-panel {
  margin-bottom: 8px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
}

.composer-panel.is-recording {
  border-color: var(--error);
  color: var(--error);
}

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

.emoji-row button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
}

.emoji-row button:hover {
  background: var(--surface-container);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-top: 8px;
}

/* Atlas */
.atlas {
  position: relative;
  z-index: 0;
  isolation: isolate;
  flex: 1;
  min-height: 0;
}

.atlas-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  isolation: isolate;
  background: #efe6d2;
}

.atlas-map .leaflet-tile-pane {
  filter: sepia(0.55) contrast(1.08) saturate(0.62) brightness(1.05);
}

.atlas-map .leaflet-container {
  background: #efe6d2;
  font-family: var(--font-ui);
}

.atlas-map .leaflet-control-zoom a {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--outline-variant) !important;
}

.atlas-map .leaflet-control-zoom-home {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.atlas-map .leaflet-control-zoom-home .material-symbols-outlined {
  font-size: 16px;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}

.fab {
  position: absolute;
  right: var(--margin);
  bottom: 16px;
  z-index: var(--z-fab);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  border-bottom: 2px solid var(--inverse-primary);
}

.fab:hover {
  transform: translateY(-2px);
}

body[data-view="atlas"] .fab {
  display: flex;
}

.map-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-fab);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  white-space: nowrap;
}

.pin-me {
  width: 22px;
  height: 30px;
  position: relative;
}

.pin-me__drop {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 4px 10px rgba(0, 101, 145, 0.35);
}

.pin-alias {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin-alias__face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--secondary);
  background: var(--surface-container);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--on-secondary-container);
}

.pin-alias__face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pin-alias__tail {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--secondary);
  margin-top: -2px;
}

.pin-alias--contact .pin-alias__face {
  border-color: var(--primary);
}

.pin-alias--contact .pin-alias__tail {
  border-top-color: var(--primary);
}

.pin-hub {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--tertiary-fixed);
  color: var(--on-tertiary-container);
  border: 2px solid var(--tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.pin-flight {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-container-lowest);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pin-flight img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  transform-origin: center;
}

.leaflet-div-icon {
  background: transparent;
  border: 0;
}

/* Aliases */
.alias-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
}

.stat-grid h3 {
  margin: 4px 0 0;
}

.stat-grid p {
  margin: 2px 0 0;
  font-size: var(--fs-label-sm);
  color: var(--on-surface-variant);
}

.alias-limit-hint {
  margin: -8px 0 0;
  font-size: var(--fs-label-sm);
  color: var(--on-surface-variant);
  text-align: center;
}

.alias-limit-hint--full {
  color: var(--error);
}

.home-portrait {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.home-portrait .avatar,
.home-portrait .avatar-fallback,
.home-portrait__btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.home-portrait__btn {
  position: relative;
  display: block;
  padding: 0;
  overflow: visible;
}

.home-portrait__btn:hover .home-portrait__cam,
.home-portrait__btn:focus-visible .home-portrait__cam {
  transform: scale(1.08);
}

.home-portrait__btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.home-portrait__cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface-container-lowest);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}

.home-portrait__cam .material-symbols-outlined {
  font-size: 13px;
}

.alias-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md) var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  position: relative;
}

.alias-card--active {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--surface-container-highest));
  box-shadow: 0 4px 20px rgba(0, 101, 145, 0.08);
}

.alias-card--active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--primary);
}

.alias-card--expired {
  opacity: 0.78;
  filter: grayscale(0.2);
  background: var(--surface-container-low);
}

.alias-card__who {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 180px;
  flex: 1 1 200px;
}

.alias-card__who .avatar,
.alias-card__who .avatar-fallback {
  width: 56px;
  height: 56px;
}

.alias-card__who h3 {
  margin: 0;
}

.alias-card__tags {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.alias-card__note {
  margin: 6px 0 0;
  font-size: var(--fs-label-sm);
  color: var(--primary);
}

.alias-card__note--muted {
  color: var(--on-surface-variant);
}

.alias-card--expired .alias-card__note {
  color: var(--on-surface-variant);
}

.alias-card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(56px, 1fr));
  gap: 4px 16px;
  flex: 1.2 1 220px;
  min-width: 200px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-container-low) 70%, transparent);
}

.alias-stat strong {
  display: block;
  font-size: var(--fs-headline-sm);
  font-weight: 600;
  line-height: 1.2;
}

.alias-stat span {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-label-sm);
  color: var(--on-surface-variant);
  text-transform: lowercase;
}

.alias-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.alias-card__side .btn {
  min-height: 36px;
  padding: 6px 14px;
}

@media (max-width: 767px) {
  .alias-card__stats {
    flex: 1 1 100%;
    min-width: 0;
  }

  .alias-card__side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
  }
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--live {
  background: color-mix(in srgb, var(--secondary-container) 50%, transparent);
  color: var(--secondary);
}

.badge--dead {
  background: var(--surface-variant);
  color: var(--on-surface-variant);
}

.countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

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

.invite-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.invite-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-container) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--on-surface);
}

.invite-chip .avatar,
.invite-chip .avatar-fallback {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.invite-chip .material-symbols-outlined {
  font-size: 16px;
  color: var(--outline);
}

.invite-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.invite-hit {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 8px;
  border-radius: var(--radius);
  color: inherit;
}

.invite-hit:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.invite-hit .avatar,
.invite-hit .avatar-fallback {
  width: 36px;
  height: 36px;
}

.invite-hit strong {
  display: block;
  font-size: 14px;
}

.invite-hit span {
  display: block;
  font-size: 12px;
  color: var(--outline);
}

.invite-empty {
  margin: 10px 0 0;
  font-size: var(--fs-label-sm);
  color: var(--on-surface-variant);
}

.invite-loc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Fleet */
.sheet,
.modal {
  position: fixed;
  top: var(--vv-offset, 0px);
  left: 0;
  right: 0;
  height: var(--app-height, 100dvh);
  z-index: var(--z-sheet);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  background: color-mix(in srgb, var(--surface-variant) 40%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sheet__panel,
.modal__panel {
  width: 100%;
  max-width: 720px;
  flex: 0 0 auto;
  max-height: min(92dvh, 880px, var(--app-height, 100dvh));
  background: var(--surface);
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--surface-container-highest);
}

.modal {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.photo-view {
  position: fixed;
  top: var(--vv-offset, 0px);
  left: 0;
  right: 0;
  width: 100%;
  height: var(--app-height, 100dvh);
  z-index: var(--z-lightbox);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: rgba(12, 14, 16, 0.94);
  cursor: zoom-out;
  -webkit-tap-highlight-color: transparent;
}

.photo-view:focus,
.photo-view:focus-visible {
  outline: none;
}

.photo-view img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.modal__panel {
  border-radius: var(--radius-xl);
  max-height: 90dvh;
}

.sheet__handle {
  width: 48px;
  height: 6px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--outline-variant) 55%, transparent);
  margin: 14px auto 0;
}

.sheet__head,
.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px 12px;
}

.sheet__head h2,
.modal__head h2 {
  margin: 0;
  color: var(--primary);
}

.sheet__head p,
.modal__head p {
  margin: 8px 0 0;
  font-family: var(--font-message);
  color: var(--on-surface-variant);
}

.sheet__body,
.modal__body {
  overflow-y: auto;
  padding: 0 24px 24px;
  flex: 0 1 auto;
  min-height: 0;
}

html.is-keyboard .sheet__foot,
html.is-cipher-editing .sheet__foot {
  padding-bottom: 12px;
}

.sheet__foot {
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--surface-container-highest);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.tier-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}

.fleet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.fleet-card {
  position: relative;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
}

.fleet-card--active {
  border: 2px solid var(--primary-container);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.fleet-card--locked {
  background: var(--surface-container-low);
  border: 1px dashed var(--outline-variant);
  opacity: 0.8;
  filter: grayscale(0.8);
  cursor: not-allowed;
}

.fleet-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.fleet-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary-fixed);
  border: 2px solid var(--primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fleet-card--locked .fleet-avatar {
  border-color: var(--outline-variant);
  background: var(--surface-container);
}

.fleet-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary-container) 12%, transparent);
  color: var(--primary);
  font-size: var(--fs-label-sm);
}

.progress {
  height: 8px;
  background: var(--surface-container-high);
  border-radius: 99px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--tertiary-fixed-dim);
  border-radius: 99px;
}

/* Settings */
.settings-card {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
}

.settings-hint {
  margin: 0 0 8px;
  color: var(--on-surface-variant);
  font-size: 13px;
  line-height: 1.45;
}

.settings-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 70%, transparent);
}

#settings-notify > .settings-toggle:first-of-type {
  border-top: 0;
}

.settings-toggle strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.settings-toggle small {
  display: block;
  margin-top: 2px;
  color: var(--on-surface-variant);
  font-size: 13px;
  line-height: 1.4;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}

.switch input {
  appearance: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch > span {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: var(--surface-container-highest);
  transition: background 0.18s ease;
}

.switch > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(27, 28, 26, 0.28);
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.notify-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  border-radius: var(--radius-md);
}

.notify-banner p {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 13px;
}

.notify-banner__title {
  margin: 0 0 4px !important;
  color: var(--on-surface) !important;
  font-size: 15px !important;
  font-weight: 600;
}

.notify-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.premium-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--tertiary-fixed);
  color: var(--on-tertiary-container);
  font-size: 12px;
  font-weight: 600;
}

/* Toasts */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  box-shadow: var(--shadow-paper);
  font-size: 14px;
}

.toast--error {
  background: var(--error);
  color: var(--on-error);
}

@media (max-width: 767px) {
  body:not([data-view="chat"]):not([data-view="auth"]):not([data-view="boot"]) .toasts {
    bottom: calc(var(--bottomnav-h) + 12px);
  }

  html.is-keyboard .toasts {
    bottom: 12px;
  }
}

.picker-map {
  height: 260px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 8px 0 16px;
}

.meta-dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  font-size: 14px;
}

.meta-dl dt {
  color: var(--outline);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Scrollbars */
.view::-webkit-scrollbar,
.chat-thread::-webkit-scrollbar,
.sheet__body::-webkit-scrollbar,
.delivery-board__rows::-webkit-scrollbar {
  width: 4px;
}

.view::-webkit-scrollbar-thumb,
.chat-thread::-webkit-scrollbar-thumb,
.sheet__body::-webkit-scrollbar-thumb,
.delivery-board__rows::-webkit-scrollbar-thumb {
  background: var(--outline-variant);
  border-radius: 20px;
}

@media (min-width: 768px) {
  .topbar--mobile {
    display: none;
  }

  .topbar--desktop {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .page {
    padding-bottom: 40px;
  }

  .toasts {
    bottom: 24px;
  }

  .alias-grid {
    grid-template-columns: 1fr 2fr;
  }

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

  .bubble-stack {
    max-width: 70%;
  }

  .fab {
    bottom: 32px;
    right: 32px;
  }

  .sheet {
    justify-content: center;
    padding: 24px;
  }

  .sheet__panel {
    border-radius: 32px;
    max-height: 86dvh;
  }

  .sheet__handle {
    display: none;
  }

}

@media (min-width: 1024px) {
  .fleet-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble.is-new,
  .fab,
  .btn,
  .fleet-card {
    animation: none;
    transition: none;
  }
}

.chat-avatar-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
}

.chat-avatar-btn:disabled {
  cursor: default;
}

.chat-avatar-btn:not(:disabled):hover {
  opacity: 0.86;
}

.chat-avatar-btn .avatar,
.chat-avatar-btn.avatar-fallback {
  width: 40px;
  height: 40px;
}

.settings-link {
  display: block;
  padding: 10px 0;
  font-weight: 600;
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 70%, transparent);
}

.settings-card > .settings-link:first-child {
  border-top: 0;
  padding-top: 0;
}

.blocked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 70%, transparent);
}

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

.docs-root {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px var(--margin) 40px;
  overflow-y: auto;
}

.docs-page {
  width: 100%;
  max-width: 640px;
  padding: 28px 22px 32px;
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
}

.docs-back {
  display: inline-block;
  margin-bottom: 18px;
  font-size: var(--fs-label);
  font-weight: 600;
}

.docs-kicker {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
}

.docs-lede {
  margin: 0 0 28px;
  font-family: var(--font-message);
  font-size: 17px;
  line-height: 1.55;
  color: var(--on-surface-variant);
}

.docs-section {
  margin: 0 0 24px;
}

.docs-section h2 {
  margin: 0 0 8px;
  font-size: var(--fs-headline-sm);
  color: var(--primary);
}

.docs-section p,
.docs-section li {
  font-family: var(--font-message);
  font-size: 16px;
  line-height: 1.6;
  color: var(--on-surface);
}

.docs-section p {
  margin: 0 0 10px;
}

.docs-section ul {
  margin: 0;
  padding-left: 1.2em;
}

.docs-section li + li {
  margin-top: 8px;
}

.docs-foot {
  margin: 28px 0 0;
  font-size: var(--fs-label);
  color: var(--outline);
}

html.needs-consent .docs-root {
  padding-bottom: 200px;
}

.consent-gate {
  position: fixed;
  inset: 0;
  z-index: var(--z-consent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--margin);
  background: color-mix(in srgb, var(--on-surface) 42%, transparent);
}

.consent-gate[hidden] {
  display: none !important;
}

.consent-gate__card {
  width: 100%;
  max-width: 420px;
  padding: 24px 22px 20px;
  border-radius: var(--radius-xl);
}

.consent-gate__title {
  margin: 0 0 8px;
  color: var(--primary);
}

.consent-gate__copy {
  margin: 0 0 12px;
  color: var(--on-surface-variant);
  font-size: 15px;
  line-height: 1.5;
}

.consent-gate__links {
  margin: 0 0 16px;
  font-size: var(--fs-label);
}

.consent-gate--bar {
  align-items: flex-end;
  background: linear-gradient(transparent, color-mix(in srgb, var(--on-surface) 40%, transparent));
  pointer-events: none;
}

.consent-gate--bar .consent-gate__card {
  pointer-events: auto;
}
