:root[data-theme] {
  color-scheme: light;
  --brand-petrol: #103333;
  --brand-navy: #0b222c;
  --action: #10c5d5;
  --action-ink: #071f29;
  --action-hover: #55dce1;
  --ink: #112e35;
  --muted: #426168;
  --subtle: #4f6e72;
  --line: #c5dbd7;
  --paper: #f8fcfa;
  --canvas: #eaf4f0;
  --white: #fffefa;
  --surface-raised: #ffffff;
  --rail: #103333;
  --rail-muted: #c4e0dc;
  --accent: #006d73;
  --accent-hover: #07575d;
  --accent-light: #d9f3ef;
  --group-bg: #ddf2ed;
  --group-ink: #145350;
  --outgoing: #d8f4ef;
  --outgoing-line: #b7e3dc;
  --shadow: 0 18px 44px #0c34331c;
}

:root[data-color-scheme="dark"] {
  color-scheme: dark;
  --ink: #eefaf7;
  --muted: #bed5d2;
  --subtle: #aac6c4;
  --line: #345657;
  --paper: #122e32;
  --canvas: #0a2024;
  --white: #1b3a3d;
  --surface-raised: #17373a;
  --rail: #0b2429;
  --rail-muted: #b6d4d3;
  --accent: #79e9ea;
  --accent-hover: #b2f5f3;
  --accent-light: #1a4549;
  --group-bg: #1b4347;
  --group-ink: #a7ebe7;
  --outgoing: #19494b;
  --outgoing-line: #39787a;
  --shadow: 0 18px 44px #000c153b;
}

.pilot .button.primary,
#link-dialog .button.primary {
  border-color: var(--action);
  background: var(--action);
  color: var(--action-ink);
}

.pilot .button.primary:hover,
#link-dialog .button.primary:hover {
  border-color: var(--action-hover);
  background: var(--action-hover);
}

.pilot { max-width: 1120px; margin: 0 auto; padding: 16px 22px 30px; }
.pilot-bar { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 18px; }
.pilot-bar a:first-child {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 750;
  letter-spacing: -.04em;
  text-decoration: none;
}
.pilot-bar img { display: block; width: 40px; height: 40px; border-radius: 11px; }
.pilot-card { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); padding: 19px; min-width: 0; }
.pilot-card h1 { margin: 3px 0 14px; }
.pilot-card h2 { font-size: 1rem; }
.pilot-card p, .pilot-note { color: var(--muted); }
.pilot-note { font-size: .8rem; margin: 0 2px 10px; }
.pilot form label { display: grid; gap: 5px; font-weight: 700; }
.pilot form label + label { margin-top: 12px; }
.pilot form label small { display: inline; }
.pilot form input, .pilot form textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: var(--white); color: var(--ink); font-size: 16px; }
.pilot-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.pilot-field { display: flex; gap: 7px; align-items: stretch; margin-top: 6px; }
.pilot-field .button { flex-shrink: 0; }
.pilot-entry {
  background: radial-gradient(ellipse at 24% 49%, color-mix(in srgb, var(--brand-petrol) 25%, var(--canvas)) 0%, var(--canvas) 58%);
  color: var(--ink);
}
.pilot-entry .pilot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  max-width: 1280px;
  padding: max(24px, env(safe-area-inset-top)) clamp(20px, 4vw, 56px) max(28px, env(safe-area-inset-bottom));
}
.pilot-entry .pilot-bar { display: none; }
.pilot-entry .pilot-error {
  align-self: flex-end;
  width: min(100%, 440px);
  padding: 12px 14px;
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--ink);
}
.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(330px, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}
.auth-brand {
  display: grid;
  grid-template-columns: minmax(0, 2.65fr) minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-width: 0;
  container-type: inline-size;
  padding: clamp(0px, 1vw, 14px);
}
.auth-brand-bird {
  display: block;
  aspect-ratio: 440 / 365;
  /* Show the original bird inside the icon's perimeter. */
  background: url("/helo-512.png") no-repeat 59.72% 53.06% / 116.36% auto;
  mask-image: linear-gradient(to right, transparent, #000 6%, #000 96%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent), radial-gradient(ellipse 70% 70% at center, #000 52%, transparent 93%);
  mask-composite: intersect;
}
:root[data-color-scheme="light"] .pilot-entry {
  background: radial-gradient(ellipse at 24% 49%, var(--accent-light), var(--canvas) 58%);
}
:root[data-color-scheme="light"] .auth-brand-bird {
  /* Follow the silhouette in the original 440 × 365 crop. */
  mask-image: none;
  clip-path: polygon(
    14.32% 6.30%, 15.50% 9.29%, 17.31% 12.57%, 19.58% 15.85%,
    22.31% 19.13%, 25.63% 22.48%, 29.02% 25.48%, 32.87% 28.48%,
    36.94% 31.21%, 40.32% 32.83%, 42.72% 33.91%, 45.56% 32.50%,
    48.09% 29.73%, 49.93% 26.14%, 51.97% 21.76%, 53.99% 18.78%,
    56.46% 16.34%, 59.53% 14.19%, 62.95% 13.09%, 65.68% 12.82%,
    68.65% 13.37%, 71.38% 14.74%, 73.94% 15.84%, 76.12% 16.10%,
    78.86% 15.62%, 81.14% 15.07%, 84.09% 14.79%, 86.82% 14.93%,
    88.86% 15.34%, 91.36% 16.44%, 93.41% 18.08%, 94.77% 19.45%,
    95.45% 20.74%, 94.66% 20.00%, 93.18% 18.85%, 91.36% 17.67%,
    88.86% 16.71%, 86.14% 16.16%, 83.64% 16.30%, 81.36% 17.40%,
    78.86% 18.49%, 77.05% 19.18%, 75.45% 21.37%, 72.99% 24.15%,
    70.95% 27.97%, 69.59% 32.07%, 68.91% 35.88%, 69.14% 40.56%,
    69.37% 45.49%, 69.60% 50.42%, 68.90% 55.44%, 67.52% 59.88%,
    65.22% 64.32%, 62.14% 68.41%, 58.43% 71.49%, 54.18% 73.47%,
    49.81% 74.58%, 45.05% 75.12%, 40.23% 76.16%, 37.16% 77.26%,
    34.77% 78.90%, 32.39% 80.55%, 30.68% 82.19%, 29.20% 83.84%,
    27.84% 85.48%, 26.70% 87.12%, 25.80% 88.77%, 25.05% 90.41%,
    24.43% 92.05%, 23.82% 93.97%, 24.05% 91.78%, 24.43% 89.59%,
    25.11% 87.12%, 25.77% 84.93%, 27.00% 82.19%, 28.02% 80.00%,
    29.20% 77.81%, 30.34% 75.62%, 31.48% 73.15%, 32.50% 71.23%,
    33.07% 69.32%, 31.36% 70.41%, 28.85% 71.02%,
    25.52% 70.48%, 22.43% 69.41%, 19.70% 67.34%, 17.14% 64.63%,
    15.16% 61.27%, 13.82% 58.05%, 16.38% 59.12%, 18.87% 59.94%,
    21.59% 60.21%, 23.83% 60.23%, 23.83% 58.13%, 21.35% 57.59%,
    18.25% 56.24%, 15.20% 54.57%, 12.24% 51.55%, 9.77% 48.41%,
    7.72% 44.64%, 6.34% 40.19%, 5.42% 36.03%, 5.18% 31.79%,
    5.44% 28.16%, 7.83% 31.12%, 10.94% 34.20%, 13.89% 36.94%,
    16.84% 38.85%, 19.36% 40.47%, 17.20% 37.15%, 15.61% 33.87%,
    14.04% 30.71%, 12.91% 26.87%, 12.22% 23.02%, 11.77% 19.19%,
    12.00% 15.33%, 12.69% 10.59%
  );
}
.auth-brand-name {
  align-self: center;
  padding-left: 3px;
  color: var(--ink);
  font-size: clamp(1.7rem, 5.2vw, 4.75rem);
  font-size: clamp(1.7rem, 11.75cqi, 4.75rem);
  font-weight: 650;
  letter-spacing: -.052em;
  line-height: .95;
  white-space: nowrap;
  transform: translateY(-30%);
}
.auth-panel {
  justify-self: end;
  width: min(100%, 440px);
  padding: clamp(22px, 3.2vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.auth-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.035em;
}
.auth-panel p { color: var(--muted); font-size: 1.067rem; }
.auth-panel form, .auth-panel > .button { margin-top: 24px; }
.auth-panel label { font-size: .95rem; }
.auth-panel label small { color: var(--muted); font-weight: 500; }
.auth-panel .pilot-field { margin-top: 8px; }
.pilot .auth-panel input {
  min-height: 48px;
  border-color: var(--line);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink);
}
.auth-panel input::placeholder { color: var(--muted); opacity: 1; }
.auth-panel .button.primary {
  min-height: 48px;
  padding-inline: 16px;
  border-radius: 11px;
  font-size: .95rem;
}
.auth-panel :focus-visible { outline-color: var(--accent); }
.auth-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 22px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.auth-theme select {
  min-height: 40px;
  max-width: 66%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
}
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: clamp(16px, 4vw, 28px); }
  .auth-brand { max-width: 420px; }
  .auth-panel { justify-self: center; }
  .pilot-entry .pilot-error { align-self: center; }
}
@media (max-width: 360px) {
  .auth-panel { padding: 17px; }
  .auth-theme select { min-height: 36px; }
}
.pilot-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
#workspace[data-tab="chats"] .pilot-grid { max-width: 740px; margin-inline: auto; }
.pilot-error { max-width: 100%; padding: 8px 11px; margin-bottom: 10px; border-left: 4px solid var(--accent); border-radius: 6px; background: var(--accent-light); }
#link-content { display: grid; gap: 10px; }
#link-content p { margin: 0; color: var(--muted); }
#share-link { min-width: 0; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--ink); font-size: 16px; }
#copy-link { justify-self: start; }
@media (max-width: 720px) {
  .pilot { padding: 9px 10px 20px; }
  .pilot-card { padding: 14px; }
  .pilot-card h1 { font-size: 1.65rem; }
}

.workspace-page {
  width: min(100%, 960px);
  min-width: 0;
  margin-inline: auto;
}

.workspace-heading { margin-bottom: clamp(16px, 3vw, 26px); }
.workspace-heading h1 { font-size: clamp(2rem, 5vw, 2.7rem); letter-spacing: -.055em; }

.workspace-card {
  min-width: 0;
  padding: clamp(15px, 2.3vw, 26px);
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--paper);
}

.workspace-card h2 {
  font-size: 1.13rem;
  line-height: 1.3;
  letter-spacing: -.025em;
}

#workspace { padding-bottom: calc(106px + var(--safe-bottom)); }
#workspace[data-tab="contacts"] > .pilot-grid { grid-template-columns: minmax(0, 1fr); }
#workspace[data-tab="contacts"] .pilot-chat,
#workspace[data-tab="chats"] .pilot-contacts { display: none; }

.contacts-layout {
  display: grid;
  grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: clamp(12px, 2.6vw, 24px);
}

.contact-discovery form { margin-top: 16px; }
.contact-discovery form label { font-size: .88rem; color: var(--muted); }
.workspace-search { gap: 8px; }
.workspace-search-field { position: relative; flex: 1; min-width: 0; }
.workspace-search-field svg {
  position: absolute;
  inset: 50% auto auto 11px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.workspace-search-field #username { min-height: 46px; padding-inline-start: 36px; border-radius: 12px; }
.workspace-search-field #username::placeholder { color: var(--muted); opacity: 1; }
.workspace-search .button.primary {
  min-height: 46px;
  padding-inline: 15px;
  border-radius: 12px;
  border-color: var(--action);
  background: var(--action);
  color: var(--action-ink);
  font-size: .94rem;
}
.workspace-search .button.primary:hover { border-color: var(--action-hover); background: var(--action-hover); }

#search-result:not(:empty) { margin-top: 9px; }
.contact-qr-actions { margin-top: 16px; border-top: 1px solid var(--line); }
.workspace-card h2 + .workspace-rows { margin-top: 9px; }

.workspace-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 55px;
  padding: 7px 8px;
  border-radius: 11px;
  text-align: start;
  font-size: .97rem;
  font-weight: 650;
}
.workspace-row + .workspace-row { border-top: 1px solid var(--line); }
.workspace-row:hover:not(:disabled) { background: var(--surface-raised); }
.workspace-row:disabled { opacity: .62; cursor: default; }
.workspace-row::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-inline-start: 1px;
  border: solid var(--muted);
  border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
}
.workspace-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-light);
  color: var(--accent);
}
.workspace-icon svg { width: 20px; height: 20px; }

.contact-directory { min-height: 190px; }
#friends-list > p, #search-result > p { padding-block: 12px 6px; color: var(--muted); }
.pilot-contacts .pilot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-block: 11px;
  border-bottom: 1px solid var(--line);
}
.pilot-contacts .pilot-row:last-child { border-bottom: 0; }
.pilot-contacts .pilot-row .person {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  flex: 1 0 114px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.pilot-contacts .pilot-row .person::before {
  content: "";
  grid-row: span 2;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background:
    radial-gradient(circle 5px at 50% 37%, var(--accent) 98%, transparent),
    radial-gradient(ellipse 8px 5px at 50% 70%, var(--accent) 98%, transparent),
    var(--accent-light);
}
.pilot-contacts .pilot-row small { display: block; color: var(--muted); }
.pilot-contacts .pilot-row .button {
  min-height: 44px;
  padding-inline: 11px;
  border-radius: 10px;
  font-size: .88rem;
}
.pilot-contacts .pilot-row .button.primary {
  border-color: transparent;
  background: var(--accent-light);
  color: var(--accent);
}
.pilot-contacts .pilot-row .button.primary:hover { border-color: var(--accent); }

#pilot-profile-page { max-width: 860px; }
.profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(0, 1.15fr);
  grid-template-rows: auto 1fr;
  gap: 13px;
  align-items: stretch;
}
.profile-identity {
  display: grid;
  align-content: center;
  justify-items: center;
  grid-row: span 2;
  gap: 15px;
  padding-block: 23px;
  background: var(--surface-raised);
  text-align: center;
}
.profile-avatar {
  display: grid;
  place-items: center;
  width: clamp(73px, 16vw, 104px);
  aspect-ratio: 1;
  border-radius: 34%;
  background: var(--brand-petrol);
  color: var(--action);
}
.profile-avatar svg { width: 55%; height: auto; }
.pilot-profile { display: grid; gap: 3px; max-width: 100%; overflow-wrap: anywhere; }
.pilot-profile strong { font-size: 1.35rem; line-height: 1.16; }
.pilot-profile small { display: block; color: var(--muted); }

#pilot-settings-page { max-width: 660px; }
.workspace-setting {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-top: 17px;
  padding-block: 13px 0;
  border-top: 1px solid var(--line);
}
.workspace-setting label { display: block; font-weight: 650; }
.workspace-setting p { color: var(--muted); font-size: .85rem; }
#pilot-theme {
  min-height: 44px;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink);
  font-size: max(1rem, 16px);
}

.pilot-nav {
  position: fixed;
  z-index: 3;
  inset: auto 0 calc(11px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  width: min(460px, calc(100% - 20px));
  margin-inline: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--paper);
  color: var(--muted);
  box-shadow: var(--shadow);
}
.pilot-nav button {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  min-height: 50px;
  padding: 4px 0;
  border-radius: 17px;
  font-size: clamp(10px, 2.75vw, 12px);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}
.pilot-nav button:hover { background: var(--surface-raised); color: var(--ink); }
.pilot-nav button[aria-current="page"] { background: var(--accent-light); color: var(--accent); }
.pilot-nav svg { width: 22px; height: 22px; }
#pilot-open-camera { min-height: 55px; background: var(--action); color: var(--action-ink); }
#pilot-open-camera:hover { background: var(--action-hover); color: var(--action-ink); }

@media (max-width: 720px) {
  .contacts-layout, .profile-layout { grid-template-columns: minmax(0, 1fr); }
  .profile-identity { grid-row: auto; }
  .workspace-card { border-radius: 18px; }
}

@media (max-width: 350px) {
  .workspace-setting { grid-template-columns: 36px minmax(0, 1fr); }
  #pilot-theme { grid-column: 2; justify-self: start; }
}

.pilot-card.pilot-chat {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 26px;
}

.conversation-index {
  min-height: min(460px, 66svh);
  padding: clamp(16px, 4vw, 28px);
}

.conversation-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.conversation-index-head h1 {
  margin: 0;
  font-size: clamp(1.85rem, 5.5vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -.045em;
}

.conversation-new.button {
  min-height: 44px;
  padding-inline: 14px;
  border-color: transparent;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--ink);
  white-space: nowrap;
}

.conversation-new.button:hover { border-color: var(--accent); }
.conversation-new span { color: var(--accent); font-size: 1.25rem; line-height: 1; }

#pilot-chat-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.conversation-list-button.button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  gap: 12px;
  width: 100%;
  min-height: 67px;
  padding: 9px 14px;
  border-color: transparent;
  border-radius: 17px;
  background: var(--surface-raised, var(--white));
  color: var(--ink);
  text-align: start;
}

.conversation-list-button.button:hover { border-color: var(--outgoing-line); background: var(--accent-light); }
.conversation-list-person { display: grid; min-width: 0; gap: 3px; }
.conversation-list-person strong, .conversation-list-person small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-list-person strong { font-size: .96rem; }
.conversation-list-person small { color: var(--muted); font-size: .79rem; font-weight: 500; }

.conversation-avatar {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 1px solid var(--outgoing-line);
  border-radius: 15px;
  background: linear-gradient(145deg, var(--outgoing), var(--accent-light));
  color: var(--ink);
  font-size: .86rem;
  font-weight: 750;
}

.conversation-chevron {
  width: 8px;
  height: 8px;
  margin-inline: 3px;
  border-block-start: 2px solid currentColor;
  border-inline-end: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg);
}

.conversation-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 230px;
  padding: 20px;
  text-align: center;
}

.conversation-empty h2, .conversation-empty p { margin: 0; }
.conversation-empty h2 { font-size: 1.06rem; }
.conversation-empty p { max-width: 28ch; font-size: .88rem; line-height: 1.5; }

.conversation-glyph {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
  border: 1px solid var(--outgoing-line);
  border-radius: 21px;
  background: var(--accent-light);
  color: var(--accent);
}

.conversation-glyph::before {
  width: 25px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 8px 8px 8px 2px;
  content: "";
}

.conversation-glyph::after {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -6px 0 currentColor, 6px 0 currentColor;
  content: "";
}

.conversation-thread { display: grid; }

.conversation-thread-head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 76px;
  padding: 12px clamp(12px, 3.5vw, 24px);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised, var(--white));
}

.conversation-back.button { width: 44px; min-height: 44px; padding: 0; border-radius: 14px; }
.conversation-back .conversation-chevron { width: 9px; height: 9px; color: var(--ink); transform: rotate(-135deg); }
.conversation-partner { min-width: 0; }
.conversation-partner h2, .conversation-partner p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-partner h2 { font-size: 1.03rem; }
.conversation-partner p { margin-top: 3px; font-size: .78rem; }

.conversation-transcript {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent-light) 35%, var(--canvas)), var(--canvas) 68%);
}

.conversation-history.button {
  align-self: center;
  min-height: 38px;
  margin: 10px 12px 0;
  border-radius: 999px;
  font-size: .78rem;
}

.conversation-security.button {
  min-height: 32px;
  align-self: center;
  margin: 8px 12px 0;
  color: var(--accent-ink, var(--ink));
  font-size: .78rem;
}
.helo-notification-setting {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}
.helo-notification-setting + .helo-notification-setting { border-top: 1px solid var(--line); }
.helo-notification-setting input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}
.helo-notification-setting p:empty { display: none; }

.pilot-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: clamp(220px, 49dvh, 550px);
  min-width: 0;
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  padding: 14px clamp(12px, 3.5vw, 24px);
}

.pilot-feed:focus-visible { outline-offset: -3px; }
.pilot-feed .conversation-empty { flex: 1; min-height: 0; }
.conversation-date { align-self: center; margin: 5px 0 3px; color: var(--muted); font-size: .73rem; text-align: center; }

.pilot-message {
  display: grid;
  gap: 4px;
  align-self: flex-start;
  max-width: min(84%, 480px);
  padding: 9px 12px 7px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 5px;
  background: var(--white);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pilot-message.mine { align-self: flex-end; border-color: var(--outgoing-line); border-radius: 16px 16px 5px 16px; background: var(--outgoing); }
.conversation-text { white-space: pre-wrap; line-height: 1.43; }
.pilot-message time { justify-self: end; color: var(--muted); font-size: .69rem; font-variant-numeric: tabular-nums; }
.conversation-message-meta {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-size: .69rem;
  white-space: nowrap;
}
.conversation-receipt { font-weight: 650; }
.conversation-receipt[data-receipt-state="read"] { color: var(--accent); }

.pilot-message.photo-message { width: min(84%, 314px); padding: 6px 6px 5px; }
.photo-message .conversation-message-meta { padding-inline: 6px; }
.conversation-photo-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 56px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--ink);
  text-align: left;
  font: inherit;
  font-weight: 650;
}
.photo-message.mine .conversation-photo-card {
  border-color: var(--outgoing-line);
  background: var(--outgoing);
}
button.conversation-photo-card { cursor: pointer; }
button.conversation-photo-card:hover { background: var(--accent-light); }
button.conversation-photo-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.conversation-photo-icon {
  display: block;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.conversation-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.conversation-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  padding: 12px clamp(12px, 3.5vw, 24px);
  border-top: 1px solid var(--line);
  background: var(--surface-raised, var(--white));
}

.conversation-attach.button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border-radius: 16px;
}
.conversation-attach svg { width: 22px; height: 22px; }

.pilot .conversation-composer textarea {
  min-height: 46px;
  max-height: 132px;
  padding: 11px 13px;
  border-radius: 16px;
  background: var(--paper);
  line-height: 1.45;
  resize: vertical;
}

.conversation-composer textarea::placeholder { color: var(--muted); }
@supports (field-sizing: content) {
  .pilot .conversation-composer textarea { field-sizing: content; resize: none; }
}

.conversation-send.button.primary {
  min-width: 63px;
  min-height: 46px;
  padding-inline: 15px;
  border-color: var(--action, var(--accent));
  border-radius: 16px;
  background: var(--action, var(--accent));
  color: var(--action-ink, var(--paper));
}

.conversation-send.button.primary:hover { background: var(--action-hover, var(--accent-hover)); }

@media (max-width: 720px) {
  .pilot-card.pilot-chat { border-radius: 22px; }
  .conversation-index { min-height: min(415px, 61svh); }
  .conversation-index-head { margin-bottom: 17px; }
  .conversation-thread-head { min-height: 68px; }
  .pilot-feed { height: clamp(180px, 47dvh, 430px); }
  .pilot-message { max-width: 89%; }
}

#pilot-camera {
  --camera-field: #071a25;
  --camera-control: #132d38;
  --camera-text: #f4ffff;
  --camera-muted: #c7e2e5;
  --camera-line: #a4dade56;
  color-scheme: dark;
  overflow: hidden;
  border: 1px solid var(--camera-line);
  background: var(--camera-field);
  color: var(--camera-text);
}
#pilot-camera::backdrop, #qr-dialog::backdrop { background: #03151cba; }
#pilot-camera-preview-video {
  position: absolute;
  inset: 68px 0 calc(102px + var(--safe-bottom));
  width: 100%;
  height: calc(100% - 170px - var(--safe-bottom));
  object-fit: contain;
}
#pilot-camera .camera-view { background: radial-gradient(ellipse at 49% 32%, #164552, var(--camera-field) 73%); }
#pilot-camera .camera-top {
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(#071a25e8, #071a2500);
}
#pilot-camera .camera-top h2 { font-size: 1.3rem; letter-spacing: -.035em; }
#pilot-camera .camera-circle, #qr-dialog #close-qr {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--camera-line);
  border-radius: 50%;
  background: var(--camera-control);
  color: var(--camera-text);
}
#pilot-camera .camera-view .camera-circle:hover { border-color: var(--action); color: var(--action-hover); }
#pilot-camera .camera-circle svg, #qr-dialog #close-qr svg, #pilot-camera-gallery-button svg { width: 21px; height: 21px; }
#pilot-camera .camera-status {
  max-width: min(340px, calc(100% - 36px));
  padding: 11px 15px;
  border: 1px solid var(--camera-line);
  border-radius: 13px;
  background: var(--camera-field);
  color: var(--camera-muted);
  font-size: .94rem;
}
#pilot-camera .camera-bottom {
  gap: 8px;
  padding: 17px max(16px, env(safe-area-inset-right, 0px)) calc(17px + var(--safe-bottom)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(#071a2500, #071a25ee 40%);
}
#pilot-camera .camera-shutter {
  width: 72px;
  height: 72px;
  border: 3px solid var(--camera-text);
  background: var(--action);
  box-shadow: inset 0 0 0 5px var(--camera-field);
}
#pilot-camera .camera-shutter:hover { background: var(--action-hover); }
#pilot-camera .camera-preview-controls button, #pilot-camera .camera-fallback button, #pilot-camera-send {
  min-height: 46px;
  padding: 9px 16px;
  border: 1px solid var(--camera-line);
  border-radius: 12px;
  background: var(--camera-control);
  font-weight: 700;
}
#pilot-camera .camera-view button:not(.camera-primary, .camera-shutter):hover { border-color: var(--action); }
#pilot-camera button.camera-primary { border-color: var(--action); background: var(--action); color: var(--action-ink); }
#pilot-camera button.camera-primary:hover:not(:disabled) { border-color: var(--action-hover); background: var(--action-hover); }
#pilot-camera .camera-view :focus-visible { outline-color: var(--action-hover); }
#pilot-camera-gallery-button {
  display: inline-flex;
  justify-self: center;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--camera-text);
  font-weight: 650;
  text-decoration: none;
}
#pilot-camera:is([data-mode="processing"], [data-mode="preview"], [data-mode="recipients"], [data-mode="sending"]) #pilot-camera-gallery-button { display: none; }
#pilot-camera .camera-recipients {
  color-scheme: light;
  gap: 14px;
  padding: max(16px, env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 24px) calc(18px + var(--safe-bottom));
  background: var(--paper);
  color: var(--ink);
}
/* The recipient sheet follows the page theme while the camera controls stay dark. */
:root[data-color-scheme="dark"] #pilot-camera .camera-recipients { color-scheme: dark; }
#pilot-camera .camera-recipients header { padding-bottom: 0; }
#pilot-camera .camera-recipients h3 { font-size: 1.3rem; letter-spacing: -.035em; }
#pilot-camera .camera-recipients .camera-circle, #qr-dialog #close-qr {
  border-color: var(--line);
  background: var(--surface-raised, var(--white));
  color: var(--ink);
}
#pilot-camera .camera-recipients .camera-circle:hover, #qr-dialog #close-qr:hover { border-color: var(--accent); background: var(--accent-light); }
#pilot-camera .camera-recipients :focus-visible { outline-color: var(--accent); }
#pilot-camera-recipient-form { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 12px; min-height: 0; }
#pilot-camera-recipient-list { display: grid; align-content: start; gap: 8px; min-width: 0; margin: 0; padding: 4px; overflow: auto; border: 0; }
#pilot-camera-recipient-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised, var(--white));
  cursor: pointer;
}
#pilot-camera-recipient-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
#pilot-camera-recipient-list input { width: 19px; height: 19px; flex: 0 0 auto; accent-color: var(--accent); }
#pilot-camera-recipient-list small { display: block; color: var(--muted); }
#pilot-camera-recipient-list span { min-width: 0; overflow-wrap: anywhere; }
#pilot-camera-recipient-status { padding-inline: 4px; color: var(--muted); }
#pilot-camera-recipient-status:empty { display: none; }
#pilot-camera button:disabled { cursor: default; opacity: .55; }

#qr-dialog {
  width: min(408px, calc(100% - 28px));
  padding: clamp(15px, 4vw, 22px);
  border-color: var(--line);
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
#qr-dialog .dialog-head { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
#qr-dialog .dialog-head h2 { font-size: 1.22rem; letter-spacing: -.028em; }
#qr-body { display: grid; justify-items: center; gap: 12px; text-align: center; }
#qr-body canvas {
  width: min(232px, 100%);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  image-rendering: pixelated;
}
#qr-body video {
  width: 100%;
  max-height: 44dvh;
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #071a25;
  object-fit: contain;
}
#qr-body p { font-size: .94rem; color: var(--muted); }
#qr-body strong { max-width: 100%; overflow-wrap: anywhere; font-size: 1.04rem; }

@media (max-width: 720px) {
  #pilot-camera { border: 0; border-radius: 0; }
}

#helo-photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #071619;
  color: #f2fcfb;
  box-shadow: none;
}

#helo-photo-viewer::backdrop { background: #071619; }

.helo-photo-viewer-content {
  position: absolute;
  inset: 0;
}

.helo-photo-viewer-content :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.helo-photo-viewer-close {
  position: absolute;
  z-index: 1;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #d7f6f86b;
  border-radius: 50%;
  color: #fff;
  background: #0b282cf0;
}

.helo-photo-viewer-close:hover { background: #174147; }
.helo-photo-viewer-close:focus-visible { outline: 2px solid #9df8ef; outline-offset: 3px; }
.helo-photo-viewer-close svg { width: 21px; height: 21px; }

.helo-photo-viewer-feedback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.helo-photo-viewer-feedback p { margin: 0; color: #e2f4f3; }
.helo-photo-viewer-feedback .button { min-height: 44px; color: var(--ink); }

.conversation-call-actions { display: flex; gap: 5px; align-items: center; }
.conversation-call-actions .button { width: 44px; min-height: 44px; padding: 0; color: var(--accent); }
.conversation-call-actions svg { width: 20px; height: 20px; }
.conversation-thread-head:has(.conversation-call-actions) { grid-template-columns: auto auto minmax(0, 1fr) auto; }

.pilot-call {
  width: min(100% - 22px, 520px);
  max-height: min(92dvh, 690px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.pilot-call::backdrop { background: #071e26bc; }
.call-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: min(52dvh, 330px);
  overflow: hidden;
  background: var(--brand-petrol);
  color: #f3fcfa;
}
.call-heading { position: relative; display: grid; justify-items: center; gap: 7px; padding: 23px 14px; text-align: center; }
.call-heading img { width: 62px; height: 62px; margin-bottom: 3px; border-radius: 18px; }
.call-heading h2 { max-width: 100%; font-size: 1.48rem; line-height: 1.14; overflow-wrap: anywhere; }
.call-heading p, .call-heading time { color: #d0eeeb; }
.call-heading time { font-variant-numeric: tabular-nums; }
.call-video-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #081d23; }
.call-video-local {
  position: absolute;
  z-index: 2;
  inset: auto 10px 10px auto;
  width: min(26%, 110px);
  aspect-ratio: 3 / 4;
  border: 1px solid #a6e4e0;
  border-radius: 12px;
  background: #081d23;
  object-fit: cover;
  transform: scaleX(-1);
}
.pilot-call.has-remote-video .call-stage { align-items: start; }
.pilot-call.has-remote-video .call-heading { padding: 9px 13px; margin-top: 8px; border-radius: 14px; background: #081d23dd; }
.pilot-call.has-remote-video .call-heading img { display: none; }
.pilot-call.has-remote-video .call-heading h2 { font-size: 1rem; }
.pilot-call.has-remote-video .call-heading p, .pilot-call.has-remote-video .call-heading time { font-size: .82rem; }
.call-actions { display: grid; justify-items: center; gap: 9px; padding: 14px 12px max(16px, env(safe-area-inset-bottom, 0px)); }
.call-control-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.call-actions .button { min-height: 44px; border-radius: 12px; }
.call-actions [aria-pressed="true"] { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.call-actions .call-end { border-color: #a5273a; background: #a5273a; color: #fff; }
.call-actions .call-end:hover { border-color: #802034; background: #802034; }
.call-actions .call-answer { border-color: var(--action); background: var(--action); color: var(--action-ink); }
.call-actions .call-answer:hover { border-color: var(--action-hover); background: var(--action-hover); }

@media (max-width: 370px) {
  .conversation-call-actions { gap: 2px; }
  .conversation-thread-head:has(.conversation-call-actions) { gap: 5px; }
}

.pilot-install-only :is(#workspace, .pilot-bar) { display: none !important; }

.pilot-mobile-install {
  display: grid;
  gap: 12px;
}

.pilot-mobile-install h1 { margin-bottom: 0; }
.pilot-mobile-install h2 { margin-bottom: 10px; font-size: 1.03rem; }
.pilot-mobile-install ol { display: grid; gap: 9px; margin: 0; padding-inline-start: 1.25em; color: var(--muted); }
.pilot-mobile-install ol li::marker { color: var(--accent); font-weight: 700; }
.pilot-mobile-install .button { justify-self: start; min-height: 44px; }

#pilot-install-handoff { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
#pilot-install-status:empty { display: none; }

.secure-dialog {
  width: min(33rem, calc(100% - 1.5rem));
  max-height: min(48rem, calc(100dvh - 2rem));
  padding: clamp(1rem, 4vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: auto;
}

.secure-dialog::backdrop { background: #05191abb; }
.secure-dialog [hidden] { display: none !important; }
.secure-dialog h2, .secure-dialog h3, .secure-dialog p { margin: 0; }
.secure-dialog h2 { font-size: clamp(1.2rem, 5vw, 1.55rem); line-height: 1.18; }
.secure-dialog h3 { font-size: 1rem; line-height: 1.35; }
.secure-dialog p { color: var(--muted); line-height: 1.5; }
.secure-dialog :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.secure-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: start;
}
.secure-heading p { margin-top: .2rem; font-size: .9rem; overflow-wrap: anywhere; }
.secure-mark, .secure-dismiss {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border: 0;
  border-radius: .85rem;
}
.secure-mark { color: var(--accent); background: var(--accent-light); }
.secure-dismiss { color: var(--ink); background: transparent; cursor: pointer; }
.secure-dismiss:hover:not(:disabled) { background: var(--accent-light); }
.secure-dismiss:disabled { opacity: .45; cursor: default; }
.secure-mark svg, .secure-dismiss svg { width: 1.35rem; height: 1.35rem; }
.secure-content, .secure-card { display: grid; gap: .75rem; }
.secure-content { margin-top: 1.1rem; }
.secure-card {
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--surface-raised);
}
.secure-card p { font-size: .9rem; }
.secure-card label { font-size: .9rem; font-weight: 650; }
.secure-card input, .secure-card textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 1rem;
}
.secure-card textarea { resize: vertical; }
.secure-card textarea, .secure-card .secure-code, #secure-secret {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.secure-code {
  display: block;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--paper);
  color: var(--ink);
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.7;
  word-spacing: .15em;
  user-select: all;
}
.secure-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.secure-status {
  border-radius: .8rem;
  padding: .65rem .75rem;
  background: var(--accent-light);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.45;
}
.secure-status[data-state="verified"] { color: var(--accent); }
.secure-dialog .button {
  justify-self: start;
  min-height: 2.75rem;
  width: fit-content;
  max-width: 100%;
  text-align: center;
}
.secure-dialog .button.primary {
  border-color: var(--action);
  background: var(--action);
  color: var(--action-ink);
}
.secure-dialog .button.primary:hover:not(:disabled) { background: var(--action-hover); }
.secure-dialog .secure-feedback:not(:empty) { margin-top: .9rem; }
.secure-dialog .secure-feedback[data-error="true"] { font-weight: 650; color: var(--ink); }
.secure-dialog #secure-retry { margin-top: .75rem; }

@media (max-width: 480px) {
  .secure-dialog:not([open]) { display: none; }
  .secure-dialog[open] {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 1rem);
    margin: 0;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    box-sizing: border-box;
    border-radius: 1.5rem 1.5rem 0 0;
  }
}

.auth-email {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.auth-email form { display: grid; gap: 9px; }
.auth-email form > .button { min-height: 46px; }
.auth-email-instructions { margin: 0; }

.auth-password {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.auth-password > .button { min-height: 46px; }
.auth-pair-consent { display: flex; gap: 10px; align-items: center; }
.auth-pair-consent input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; flex: 0 0 auto; }
