  :root {
      --bg: #0a0a0f;
      --bg2: #12121a;
      --bg3: #1a1a26;
      --border: rgba(255, 255, 255, 0.07);
      --border-bright: rgba(255, 255, 255, 0.15);
      --text: #e8e8f0;
      --text-muted: #7878a0;
      --text-dim: #4a4a68;
      --accent-stream: #00e5b4;
      --accent-danger: #ff5c5c;
      --accent-warn: #ffb347;
      --sans: 'IBM Plex Mono', monospace;
      --sans: 'DM Sans', sans-serif;
      --radius: 12px;
      --radius-sm: 8px;
      --tab-height: 64px;
      --btn-width: 42px;
      --profile-image-size: 44px;
  }

  * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
  }

  html,
  body {
      height: 100%;
  }

  body {
      font-family: var(--sans);
      color: var(--text);
      background: var(--bg);
      height: 100vh;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      font-size: 15px;
      line-height: 1.6;
      overflow: hidden;
  }

  /* ── Header ───────────────────────────────── */
  .header {
      display: flex;
      align-items: center;
      gap: 14px;
      padding-block: 20px;
      padding-inline: 20px;
      background: var(--bg2);

      .header__profile-info {
          flex: 1;
          min-width: 0;
      }

      .header__profile-image {
          position: relative;
          width: var(--profile-image-size);
          height: var(--profile-image-size);
          border-radius: 50%;
          background-color: #fff;
          border: 3px solid transparent;
          transition: border-color 0.3s ease;

          img {
              width: 100%;
              height: 100%;
              object-fit: cover;
              border-radius: inherit;
          }
      }

      /* Messenger-style presence dot, overlapping the bottom-right of the avatar ring.
       Hidden by default: only shown once a conversation is actually selected. */
      .peer-presence-dot {
          display: none;
          position: absolute;
          bottom: 0;
          right: 0;
          transform: translate(50%, 20%);
          width: 12px;
          height: 12px;
          border-radius: 50%;
          background: #8a8a9a;
      }

      .peer-presence-dot.visible {
          display: block;
      }

      .peer-presence-dot.peer-waiting {
          background: var(--accent-warn);
      }

      .peer-presence-dot.peer-online {
          background: var(--accent-stream);
          box-shadow: 0 0 6px var(--accent-stream);
      }

      /* Server/websocket/billing health takes priority over peer-presence coloring above. */
      .header__profile-image.status-healthy {
          border-color: #0a5c2b;
      }

      .header__profile-image.status-issue {
          border-color: #e7c425;
      }

      .header__profile-name {
          font-weight: 600;
          position: relative;
          display: inline-block;
      }

      .header__profile-subtitle {
          font-size: 12px;
          color: var(--text-muted);
      }

      .account-control {
          position: relative;
          margin-left: auto;
      }

      .account-menu {
          position: absolute;
          top: calc(100% + 8px);
          right: 0;
          z-index: 50;
          width: min(320px, calc(100vw - 24px));
          padding: 14px;
          background: var(--bg2);
          border: 1px solid var(--border-bright);
          border-radius: var(--radius-sm);
          box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
          opacity: 0;
          visibility: hidden;
          transform: translateY(-6px) scale(0.98);
          transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
          pointer-events: none;
      }

      .account-menu.open {
          opacity: 1;
          visibility: visible;
          transform: translateY(0) scale(1);
          pointer-events: auto;
      }

      .account-menu .field {
          margin-bottom: 10px;
      }

      .profile-image-actions {
          display: flex;
          align-items: center;
          gap: 8px;
      }

      .profile-image-input {
          position: absolute;
          width: 1px;
          height: 1px;
          opacity: 0;
          pointer-events: none;
      }

      .profile-image-actions .btn {
          width: auto;
          white-space: nowrap;
          padding: 8px 14px;
      }

      .profile-image-picker {
          cursor: pointer;
      }

      .account-menu-actions {
          display: flex;
          flex-direction: column;
          align-items: flex-start;
          gap: 8px;
      }

      .account-menu-actions .btn {
          width: 100%;
      }

  }

  /* Unread-message indicator for a conversation-list-item, grouped directly
     next to the peer name rather than floating between name and remove button. */
  .conversation-list-item-main {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      overflow: hidden;
  }

  .new-message-badge {
      display: none;
      flex: none;
      padding: 2px 8px;
      border-radius: 999px;
      background: var(--accent-danger);
      color: #fff;
      font-family: var(--sans);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.02em;
      white-space: nowrap;
  }

  .new-message-badge.visible {
      display: inline-block;
      animation: pulse 1s infinite;
  }

  @keyframes pulse {

      0%,
      100% {
          opacity: 1
      }

      50% {
          opacity: 0.4
      }
  }

  /* ── Body layout ──────────────────────────── */
  .body-wrap {
      display: flex;
      flex: 1;
      min-height: 0;
      overflow: hidden;
  }

  /* ── Main ─────────────────────────────────── */
  .main {
      flex: 1;
      min-width: 0;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
  }

  /* ── Panels ───────────────────────────────── */
  .panel {
      display: none;
  }

  .panel.active {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
  }


  .lock-card-sticky {
      position: sticky;
      bottom: 0;
      margin-top: auto;
      z-index: 5;
  }

  /* ── Cards ────────────────────────────────── */
  .card {
      background: var(--bg3);
      border: 1px solid var(--border);
      padding: 16px;
  }

  /* ── Forms ────────────────────────────────── */
  .field {
      margin-bottom: 12px;
  }

  label {
      display: block;
      font-size: 11px;
      font-family: var(--sans);
      color: var(--text-muted);
      margin-bottom: 6px;
      letter-spacing: 0.04em;
  }

  textarea,
  input[type="text"],
  input[type="email"] {
      width: 100%;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text);
      font-family: var(--sans);
      font-size: 16px;
      padding: 10px 12px;
      resize: vertical;
      transition: border-color 0.2s;
      outline: none;
  }

  /* Auto-grow textarea (WhatsApp-style): starts at one line, expands with content, then scrolls */
  textarea#stream-plaintext {
      display: block;
      resize: none;
      overflow-y: hidden;
      max-height: 160px;
      line-height: 1.4;
      font-size: 16px;
      background: #FFF;
      border: 1px solid var(--border);
      color: #000;
      font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
      /* iOS Safari's native textarea chrome (-webkit-appearance: textarea) adds its own
       top-heavy internal inset on top of padding; strip it so padding is the only inset. */
      -webkit-appearance: none;
      appearance: none;
  }

  textarea:focus,
  input[type="text"]:focus,
  input[type="email"]:focus {
      border-color: var(--border-bright);
  }

  /* ── Client-side spellcheck overlay/popup (bundled dictionary, not native) ── */
  #stream-text-field {
      position: relative;
  }

  .spellcheck-overlay {
      position: absolute;
      inset: 0;
      pointer-events: none;
      margin: 0;
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      padding: 10px 12px;
      box-sizing: border-box;
      font-family: var(--sans);
      font-size: 13px;
      line-height: 1.4;
      color: transparent;
      white-space: pre-wrap;
      word-wrap: break-word;
      overflow: hidden;
  }

  .spellcheck-overlay mark {
      background: transparent;
      color: transparent;
      text-decoration: underline wavy var(--accent-danger);
      text-underline-offset: 3px;
  }

  .spellcheck-popup {
      position: absolute;
      z-index: 30;
      display: none;
      flex-wrap: wrap;
      gap: 4px;
      max-width: 240px;
      padding: 6px;
      background: var(--bg2);
      border: 1px solid var(--border-bright);
      border-radius: var(--radius-sm);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  }

  .spellcheck-popup.visible {
      display: flex;
  }

  .spellcheck-popup button {
      background: var(--bg3);
      border: 1px solid var(--border);
      color: var(--text);
      border-radius: 6px;
      padding: 5px 9px;
      cursor: pointer;
      font-family: var(--sans);
      font-size: 12px;
  }

  .spellcheck-popup button:hover {
      border-color: var(--accent-stream);
      color: var(--accent-stream);
  }

  .spellcheck-popup-none {
      color: var(--text-dim);
      font-family: var(--sans);
      font-size: 11px;
      padding: 4px 6px;
  }

  /* ── QR code scanner (customer ID login via camera) ─────────── */
  .qr-scanner-overlay {
      position: fixed;
      inset: 0;
      z-index: 95;
      display: none;
      align-items: center;
      justify-content: center;
      background: rgba(0, 0, 0, 0.82);
      padding: 16px;
  }

  .qr-scanner-overlay.visible {
      display: flex;
  }

  .qr-scanner-panel {
      width: min(420px, 100%);
      background: var(--bg2);
      border: 1px solid var(--border-bright);
      border-radius: var(--radius-sm);
      padding: 16px;
  }

  .qr-scanner-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
      color: var(--text);
      font-family: var(--sans);
      font-size: 13px;
  }

  .qr-scanner-video-wrap {
      position: relative;
      width: 100%;
      aspect-ratio: 1 / 1;
      overflow: hidden;
      border-radius: var(--radius-sm);
      background: #000;
  }

  .qr-scanner-video-wrap video {
      width: 100%;
      height: 100%;
      object-fit: cover;
  }

  .qr-scanner-frame {
      position: absolute;
      inset: 15%;
      border: 2px solid var(--accent-stream);
      border-radius: 12px;
      pointer-events: none;
  }

  .qr-scanner-status {
      margin-top: 12px;
      padding-block: 10px;
      font-family: var(--sans);
      font-size: 12px;
      color: var(--text-muted);
      text-align: left;
  }

  /* ── Delete Account buffering spinner (issue #110) ─────────── */
  .buffering-spinner {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: 4px solid rgba(255, 255, 255, 0.25);
      border-top-color: var(--accent-stream);
      animation: buffering-spin 0.8s linear infinite;
  }

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

  .qr-code-result {
      text-align: center;
      margin-bottom: 12px;
  }

  .qr-code-result img {
      border: 1px solid var(--border-bright);
      border-radius: var(--radius-sm);
      padding: 12px;
      background: #fff;
  }

  .qr-code-fallback-id {
      margin-top: 12px;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11px;
      word-break: break-all;
      color: var(--text-muted);
  }

  .qr-code-copy-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 4px;
      text-align: left;
  }

  .qr-code-copy-row .qr-code-fallback-id {
      margin-top: 0;
      flex: 1;
      min-width: 0;
  }

  .qr-code-copy-row .btn {
      width: auto;
      flex-shrink: 0;
      padding: 8px 14px;
  }

  /* ── Buttons ──────────────────────────────── */
  .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      padding: 11px 18px;
      border-radius: var(--radius-sm);
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      border: none;
      transition: all 0.15s;
      font-family: var(--sans);
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
      width: 100%;
  }

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

  .btn-stream {
      background: var(--accent-stream);
      color: #0a0f0d;
  }

  .btn-warn {
      background: var(--accent-warn);
      color: #1a0f00;
  }

  .ghostbtn- {
      background: transparent;
      color: var(--text-muted);
      border: 1px solid var(--border);
  }

  .btn-danger {
      background: transparent;
      color: var(--accent-danger);
      border: 1px solid rgba(255, 92, 92, 0.3);
  }

  .btn-stream:hover:not(:disabled) {
      background: #00ffca;
  }

  .btn-warn:hover:not(:disabled) {
      background: #ffc96a;
  }

  .btn-ghost:hover:not(:disabled) {
      background: var(--bg3);
      color: var(--text);
  }

  .btn-danger:hover:not(:disabled) {
      background: rgba(255, 92, 92, 0.08);
  }

  .btn-row {
      display: flex;
      flex-direction: column;
      gap: 8px;
  }

  /* ── Mobile composer row (textarea + inline send/check icons) ───── */
  .composer-row {
      display: flex;
      align-items: flex-end;
      gap: 8px;
  }

  /* .field's default margin-bottom would offset align-items:flex-end against
     the icon buttons (which have no margin), pushing the textarea out of line. */
  .composer-row #stream-text-field {
      flex: 1;
      min-width: 0;
      margin-bottom: 0;
  }

  .mobile-composer-actions {
      display: none;
      gap: 8px;
      flex-shrink: 0;
  }

  body[data-stream-mode="text"] .mobile-composer-actions {
      display: flex;
  }

  body[data-stream-mode="text"] #btn-row-default {
      display: none;
  }

  /* Extra specificity (.btn.icon-btn) so this always wins over the
     `.btn { width: auto; }` rule inside the min-width:600px media query. */
  .btn.icon-btn {
      width: 42px;
      height: 42px;
      padding: 0;
      flex-shrink: 0;
  }

  .icon-btn svg {
      width: 18px;
      height: 18px;
  }

  /* Lock & Send must have exactly two visual states: disabled vs fully ready (desktop + mobile) */
  [data-role="lock-send"]:disabled {
      background: transparent;
      color: var(--text-dim);
      border: 1px solid var(--border);
  }

  [data-role="lock-send"]:not(:disabled),
  [data-role="lock-send"]:not(:disabled):hover,
  [data-role="lock-send"]:not(:disabled):focus,
  [data-role="lock-send"]:not(:disabled):active {
      background: var(--accent-stream);
      color: #0a0f0d;
      border: 1px solid rgba(0, 229, 180, 0.6);
      filter: none;
      box-shadow: none;
  }

  /* ── Output ───────────────────────────────── */
  .output-label {
      font-size: 10px;
      font-family: var(--sans);
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 6px;
  }

  #output-card {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      overflow-x: hidden;
      background: #fff;
      -webkit-overflow-scrolling: touch;
  }

  .output-block {
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 10px;
      font-family: var(--sans);
      font-size: 16px;
      color: var(--text-muted);
      word-break: break-all;
      white-space: pre-wrap;
      flex: 0 0 auto;
      align-self: flex-start;
      max-width: 85%;
      position: relative;
      margin-bottom: 10px;
  }

  .output-block.success {
      background: var(--accent-stream);
      border-color: transparent;
      color: #073b30;
      border-radius: 18px;
  }

  .output-block.error {
      border-color: rgba(255, 92, 92, 0.3);
      color: var(--accent-danger);
  }

  .output-block.idle {
      color: var(--text-dim);
  }

  #stream-unlock-out+.btn-row {
      margin-top: 10px;
  }

  /* ── Input mode toggle ─────────────────────── */
  .input-toggle {
      display: inline-flex;
      gap: 4px;
      padding: 4px;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
  }

  .toggle-btn {
      padding: 5px 14px;
      border: none;
      border-radius: 6px;
      font-size: 12px;
      font-family: var(--sans);
      cursor: pointer;
      background: transparent;
      transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
  }

  .toggle-btn.active {
      background: var(--bg2);
      color: var(--text);
      border: 1px solid var(--border-bright);
  }

  .toggle-btn:not(.active):hover {
      color: var(--text);
  }

  .toggle-btn:disabled {
      color: var(--text-dim);
      cursor: not-allowed;
      opacity: 0.5;
      background: transparent;
  }

  .toggle-btn:disabled:hover {
      color: var(--text-dim);
  }

  .field-toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      position: relative;
  }

  .settings-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: var(--btn-width);
      height: 37px;
      flex-shrink: 0;
      margin-left: auto;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
  }

  .settings-btn:hover {
      border-color: var(--border-bright);
      color: var(--text);
  }

  .settings-menu-section {
      margin-bottom: 12px;
  }

  .settings-menu-section:last-child {
      margin-bottom: 0;
  }

  .settings-menu-label {
      font-size: 10px;
      font-family: var(--sans);
      letter-spacing: 0.08em;
      color: #ffffff;
      margin-bottom: 8px;
  }

  .settings-toggle-group {
      position: relative;
      display: flex;
      gap: 4px;
      padding: 4px;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
  }

  .settings-toggle-group::before {
      content: '';
      position: absolute;
      top: 4px;
      left: 4px;
      width: calc(50% - 6px);
      height: calc(100% - 8px);
      background: var(--bg2);
      border: 1px solid var(--border-bright);
      border-radius: 6px;
      /* `left` (not transform) keeps both states resolved against the same
       50% reference, so the right inset stays pixel-equal to the left one. */
      transition: left 0.22s cubic-bezier(.22, 1, .36, 1);
  }

  .settings-toggle-group[data-active="1"]::before {
      left: calc(50% + 2px);
  }

  .settings-toggle-btn {
      position: relative;
      z-index: 1;
      flex: 1;
      padding: 8px;
      border: 1px solid transparent;
      border-radius: 6px;
      font-size: 12px;
      font-family: var(--sans);
      cursor: pointer;
      color: var(--text-muted);
      background: transparent;
      transition: color 0.18s ease;
      -webkit-tap-highlight-color: transparent;
  }

  .settings-toggle-btn.active {
      color: var(--text);
      background: transparent;
      border-color: transparent;
  }

  .settings-toggle-btn:not(.active):hover {
      color: var(--text);
  }

  .settings-toggle-btn:disabled {
      color: var(--text-dim);
      cursor: not-allowed;
      opacity: 0.5;
  }

  .settings-toggle-btn:disabled:hover {
      color: var(--text-dim);
  }

  .settings-toggle-group.disabled::before {
      opacity: 0.5;
  }

  .settings-menu-link {
      display: block;
      width: 100%;
      margin-top: 8px;
      padding: 0;
      border: none;
      background: transparent;
      text-align: left;
      font-size: 11px;
      font-family: var(--sans);
      color: var(--text-dim);
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 2px;
      -webkit-tap-highlight-color: transparent;
  }

  .settings-menu-link:hover {
      color: var(--text-muted);
  }

  .file-drop-zone {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px 14px;
      border-radius: var(--radius-sm);
      border: 1.5px dashed var(--border);
      background: var(--bg3);
      cursor: pointer;
      transition: all 0.2s;
      font-family: var(--sans);
      font-size: 12px;
      color: var(--text-muted);
  }

  .file-drop-zone:hover,
  .file-drop-zone.drag-over {
      border-color: var(--accent-stream);
      color: var(--accent-stream);
      background: rgba(0, 229, 180, 0.04);
  }

  .file-drop-zone.has-file {
      border-color: rgba(0, 229, 180, 0.4);
      border-style: solid;
      background: rgba(0, 229, 180, 0.05);
      color: var(--accent-stream);
  }

  #stream-file-label {
      font-family: var(--sans);
  }

  #stream-accepted-formats {
      font-family: var(--sans);
  }

  /* ── Selected file list (multi-file share) ───────── */
  .file-list {
      display: none;
      flex-direction: column;
      gap: 6px;
      margin-top: 10px;
  }

  .file-list-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 8px 10px;
      border-radius: var(--radius-sm);
      background: var(--bg3);
      border: 1px solid var(--border);
      font-family: var(--sans);
      font-size: 12px;
      color: var(--text-muted);
  }

  .file-list-item-name {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
  }

  #conversations-card {
      color: var(--text);
  }

  #conversations-card .output-label {
      color: var(--text);
  }

  #new-chat-phone-input {
      min-width: 0;
  }

  #new-chat-phone-input::placeholder {
      color: var(--text-muted);
      opacity: 1;
  }

  #conversations-card .settings-btn {
      color: var(--text-muted);
  }

  #conversations-card .settings-btn:hover,
  #conversations-card .settings-btn:focus-visible {
      color: var(--text);
  }

  .conversation-list-item.active {
      border-color: var(--accent-stream);
      background: rgba(0, 229, 180, 0.06);
  }

  /* Sent-but-not-yet-granted connection request — visually distinct border so the
     instigator knows they cannot chat here until the recipient approves it. */
  .conversation-list-item.pending-approval {
      border-color: var(--accent-warn);
      border-style: dashed;
      background: rgba(255, 179, 71, 0.06);
  }

  .pending-approval-badge {
      display: none;
      flex: none;
      padding: 2px 8px;
      border-radius: 999px;
      background: var(--accent-warn);
      color: #201a08;
      font-family: var(--sans);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.02em;
      white-space: nowrap;
  }

  .pending-approval-badge.visible {
      display: inline-block;
  }

  #conversation-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-top: 10px;
  }

  .conversation-list-item {
      position: relative;
      cursor: pointer;
      color: var(--text);
  }

  .customer-search-results {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 6px;
      transform-origin: top;
  }

  .customer-search-results.is-opening {
      animation: customer-search-reveal 180ms cubic-bezier(.22, 1, .36, 1);
  }

  .customer-search-results.is-closing {
      animation: customer-search-dismiss 180ms ease-in forwards;
      pointer-events: none;
  }

  .customer-search-results.is-opening button {
      animation: customer-search-row-reveal 220ms cubic-bezier(.22, 1, .36, 1) both;
  }

  .customer-search-results.is-opening button:nth-child(2) {
      animation-delay: 25ms;
  }

  .customer-search-results.is-opening button:nth-child(3) {
      animation-delay: 50ms;
  }

  .customer-search-results.is-opening button:nth-child(4) {
      animation-delay: 75ms;
  }

  .customer-search-results.is-opening button:nth-child(5) {
      animation-delay: 100ms;
  }

  @keyframes customer-search-reveal {
      from {
          opacity: 0;
          transform: translateY(-6px) scaleY(.96);
      }

      to {
          opacity: 1;
          transform: translateY(0) scaleY(1);
      }
  }

  @keyframes customer-search-dismiss {
      from {
          opacity: 1;
          transform: translateY(0) scaleY(1);
      }

      to {
          opacity: 0;
          transform: translateY(-4px) scaleY(.96);
      }
  }

  @keyframes customer-search-row-reveal {
      from {
          opacity: 0;
          transform: translateX(-6px);
      }

      to {
          opacity: 1;
          transform: translateX(0);
      }
  }

  @media (prefers-reduced-motion: reduce) {

      .customer-search-results.is-opening,
      .customer-search-results.is-closing,
      .customer-search-results.is-opening button {
          animation: none;
      }
  }

  .customer-search-results button,
  .connection-request-item button {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--bg2);
      color: var(--text);
      cursor: pointer;
      font: 500 12px var(--sans);
      letter-spacing: 0;
      padding: 8px 10px;
      text-align: left;
  }

  .customer-search-results button:hover {
      border-color: var(--accent-stream);
  }

  .customer-search-results .customer-search-result-self {
      color: var(--text-muted);
      cursor: not-allowed;
      opacity: 1;
  }

  .customer-search-results .customer-search-result-self:hover {
      border-color: var(--border);
  }

  .customer-search-self-label {
      color: var(--text);
  }

  .connection-request-item {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 0;
      font-size: 12px;
      color: var(--text-muted);
  }

  .connection-request-item span {
      flex: 1;
  }

  .connection-request-item button {
      padding: 5px 8px;
  }

  .connection-request-item button:last-child {
      color: var(--accent-danger);
  }

  .customer-login-required #conversations-card,
  .customer-login-required #panel-stream {
      filter: grayscale(1);
      opacity: 0.35;
      pointer-events: none;
  }

  .file-list-item-remove {
      flex-shrink: 0;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      padding: 0;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 13px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
  }

  .file-list-item-remove:hover {
      border-color: var(--accent-danger);
      color: var(--accent-danger);
  }

  /* ── Upload progress (multi-file send) ───────────── */
  .upload-progress {
      display: none;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
  }

  .upload-progress-track {
      flex: 1;
      height: 6px;
      border-radius: 999px;
      background: var(--bg3);
      border: 1px solid var(--border);
      overflow: hidden;
  }

  .upload-progress-bar {
      height: 100%;
      width: 0%;
      background: var(--accent-stream);
      transition: width 0.25s ease;
  }

  .upload-progress-label {
      font-size: 11px;
      font-family: var(--sans);
      color: var(--text-dim);
      white-space: nowrap;
  }

  .download-btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 8px 14px;
      border-radius: var(--radius-sm);
      font-size: 12px;
      font-family: var(--sans);
      cursor: pointer;
      background: var(--bg);
      border: 1px solid var(--border-bright);
      color: var(--text-muted);
      text-decoration: none;
      transition: all 0.15s;
  }

  .download-btn:hover {
      background: var(--bg3);
      color: var(--text);
  }

  /* ── Key expired banner ──────────────────── */
  .expired-banner {
      display: none;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      border-radius: var(--radius-sm);
      background: rgba(255, 92, 92, 0.06);
      border: 1px solid rgba(255, 92, 92, 0.3);
      font-size: 12px;
      font-family: var(--sans);
      color: var(--accent-danger);
      margin-bottom: 10px;
  }

  .expired-banner.visible {
      display: flex;
  }

  .expired-banner-icon {
      font-size: 15px;
      flex-shrink: 0;
  }

  .expired-banner-body {
      line-height: 1.6;
  }

  .expired-banner-title {
      font-weight: 600;
      margin-bottom: 2px;
  }

  .expired-banner-sub {
      color: var(--text-dim);
      font-size: 11px;
  }

  /* ── Responsive ───────────────────────────── */
  @media (min-width: 600px) {
      .btn {
          width: auto;
      }

      .btn-row {
          flex-direction: row;
          flex-wrap: wrap;
      }

      textarea {
          font-size: 12px;
      }
  }

  @media (min-width: 860px) {
      .main {
          padding: 32px 40px 0;
      }

      .lock-card-sticky {
          bottom: 0;
      }

      .card {
          padding: 24px;
      }

      body[data-stream-mode="text"] .mobile-composer-actions {
          display: none;
      }

      body[data-stream-mode="text"] #btn-row-default {
          display: flex;
      }

      #btn-row-default {
          margin-top: 12px;
      }
  }


  /* ── App notice ───────────────────────────── */
  .app-notice {
      position: fixed;
      top: 68px;
      left: 50%;
      transform: translateX(-50%);
      width: min(680px, calc(100vw - 24px));
      z-index: 90;
      border-radius: var(--radius-sm);
      border: 1px solid transparent;
      background: var(--bg2);
      color: var(--text);
      padding: 10px 12px;
      display: none;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      font-size: 12px;
      font-family: var(--sans);
      line-height: 1.6;
      box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
  }

  .app-notice.visible {
      display: flex;
  }

  .app-notice.error {
      border-color: rgba(255, 92, 92, 0.4);
      color: #ffd4d4;
      background: rgba(78, 24, 24, 0.92);
  }

  .app-notice.warn {
      border-color: rgba(255, 179, 71, 0.4);
      color: #ffe4bf;
      background: rgba(70, 45, 15, 0.92);
  }

  .app-notice.ok {
      border-color: rgba(0, 229, 180, 0.38);
      color: #c9ffef;
      background: rgba(13, 60, 49, 0.92);
  }

  .app-notice-close {
      background: none;
      border: none;
      color: inherit;
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      padding: 0 2px;
      opacity: 0.85;
  }

  .app-notice-close:hover {
      opacity: 1;
  }

  @media (min-width: 860px) {
      .app-notice {
          top: 76px;
      }
  }

  /* ── Light colour scheme (keeps brand blues, swaps text for contrast) ── */
  body[data-color-scheme="light"] {
      --bg: #0D0155;
      --bg2: #0B1042;
      --bg3: #3E63FF;
      --border: rgba(255, 255, 255, 0.14);
      --border-bright: rgba(255, 255, 255, 0.28);
      --text: #ffffff;
      --text-muted: #c7cdf5;
      --text-dim: #8b93c9;
  }

  @media (min-width: 600px) {
      .conversation-swipe-row.delete-revealed .conversation-list-item {
          transform: none;
      }

      .conversation-swipe-row.delete-revealed .conversation-delete-button {
          display: none;
      }
  }