    /* Keep the authentication card fully visible on compact desktop/tablet viewports. */
    @media (min-width: 721px) and (max-height: 920px) {
      body.login-active .login-screen { padding: 12px; overflow-y: auto; }
      body.login-active .login-card { max-height: calc(100dvh - 24px); }
      body.login-active .login-hero { padding: 28px; }
      body.login-active .login-form { padding: 24px; gap: 10px; }
      body.login-active .oauth-actions { gap: 8px; }
      body.login-active .oauth-button { min-height: 44px; }
      body.login-active .temporary-login { gap: 7px; padding-top: 10px; }
      body.login-active .temporary-login .control,
      body.login-active .temporary-login .btn { min-height: 40px; }
}

/* Multi-project access requests ------------------------------------------------ */
.pm-join-queue,
.pdp-request-center,
.se-applications {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-container-lowest);
}
.pm-join-queue > header,
.pdp-request-center > header,
.se-applications > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.pm-join-queue h2,
.pdp-request-center h2,
.se-applications h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.pm-join-queue header p,
.pdp-request-center header p,
.se-applications header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pm-join-queue > header > span,
.pdp-request-center > header > span,
.se-applications > header > span {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--amber) 18%, var(--surface-container-lowest));
  color: color-mix(in srgb, var(--amber) 76%, var(--ink));
  font-weight: 850;
}
.pm-join-list,
.pdp-applicant-list,
.se-application-list { display: grid; gap: 10px; }
.pm-join-card,
.pdp-applicant-card,
.se-application-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--brand) 3%, var(--surface-container-lowest));
  overflow: hidden;
}
.pm-join-card,
.pdp-applicant-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.pm-join-card-main,
.pdp-applicant-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 78px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.pm-join-card-main:hover,
.pm-join-card-main:focus-visible,
.pdp-applicant-main:hover,
.pdp-applicant-main:focus-visible { background: color-mix(in srgb, var(--brand) 7%, transparent); outline: none; }
.pm-join-avatar,
.pdp-applicant-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand-2) 17%, var(--surface-container-lowest));
  color: var(--brand-2);
  font-weight: 850;
}
.pm-join-copy,
.pdp-applicant-main > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.pm-join-copy strong,
.pdp-applicant-main strong { overflow-wrap: anywhere; }
.pm-join-copy small,
.pm-join-copy time,
.pdp-applicant-main small,
.pdp-applicant-main time { color: var(--muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.pm-join-open,
.pdp-applicant-open { color: var(--brand); font-size: 12px; font-weight: 800; white-space: nowrap; }
.pm-access-card { grid-template-columns: minmax(0, 1fr) auto; }
.pm-access-card.is-leave { background: color-mix(in srgb, var(--amber) 6%, var(--surface-container-lowest)); }
.pm-access-kind { width: max-content; max-width: 100%; padding: 3px 7px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); font-size: 10px; font-weight: 850; }
.pm-access-card.is-leave .pm-access-kind { background: color-mix(in srgb, var(--amber) 16%, transparent); color: color-mix(in srgb, var(--amber) 74%, var(--ink)); }
.pm-access-action { padding: 12px 14px 12px 0; }
.pm-access-action .btn { min-height: 38px; margin: 0; padding: 8px 12px; white-space: nowrap; }
.join-request-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.join-request-actions.is-compact { grid-template-columns: 1fr; padding: 10px; border-left: 1px solid var(--line); }
.join-request-actions.is-compact .btn { min-height: 34px; padding: 7px 12px; font-size: 11px; }
.join-request-actions .btn[disabled] { opacity: .6; cursor: wait; }
.pm-join-empty,
.pdp-requests-empty { display: flex; align-items: center; gap: 12px; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); }
.pm-join-empty svg,
.pdp-requests-empty svg { width: 24px; height: 24px; color: var(--green); }
.pm-join-empty strong,
.pdp-requests-empty strong { display: block; color: var(--ink); }
.pm-join-empty p,
.pdp-requests-empty p { margin: 3px 0 0; font-size: 12px; }
.pdp-applicant-card.is-selected { border-color: color-mix(in srgb, var(--brand) 60%, var(--line)); }
.pdp-request-center { margin-top: 18px; }
.pdp-applicant-detail {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--brand) 5%, var(--surface-container-lowest));
}
.pdp-applicant-detail > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pdp-applicant-detail > header > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pdp-applicant-detail h3 { margin: 2px 0 0; overflow-wrap: anywhere; }
.pdp-applicant-detail header small { color: var(--muted); }
.pdp-applicant-detail > header > button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-container-lowest);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}
.pdp-applicant-detail dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pdp-applicant-detail dl > div { min-width: 0; padding: 12px; border-bottom: 1px solid var(--line); }
.pdp-applicant-detail dl > div:nth-child(odd) { border-right: 1px solid var(--line); }
.pdp-applicant-detail dl > div:nth-last-child(-n+2) { border-bottom: 0; }
.pdp-applicant-detail dt { color: var(--muted); font-size: 11px; }
.pdp-applicant-detail dd { margin: 4px 0 0; font-weight: 750; overflow-wrap: anywhere; }
.se-applications { margin-top: 16px; }
.se-applications.is-standalone { width: min(100%, 620px); margin: 0 auto; }
.se-application-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px; }
.se-application-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb, var(--amber) 18%, var(--surface-container-lowest)); color: var(--amber); }
.se-application-icon svg { width: 22px; height: 22px; }
.se-application-copy { display: grid; min-width: 0; gap: 5px; }
.se-application-copy > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.se-application-copy strong { overflow-wrap: anywhere; }
.se-application-copy p { display: flex; flex-wrap: wrap; gap: 5px 8px; margin: 0; font-size: 12px; }
.se-application-copy p span,
.se-application-copy time { color: var(--muted); font-size: 11px; }
.se-application-withdraw { padding: 8px 10px; border: 0; background: transparent; color: var(--red); font-size: 12px; font-weight: 800; cursor: pointer; }

@media (max-width: 720px) {
  .pm-join-card,
  .pdp-applicant-card { grid-template-columns: 1fr; }
  .pm-access-action { padding: 0 14px 14px 66px; }
  .pm-access-action .btn { width: 100%; }
  .join-request-actions.is-compact { grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 0; }
  .pm-join-card-main,
  .pdp-applicant-main { grid-template-columns: 40px minmax(0, 1fr); }
  .pm-join-open,
  .pdp-applicant-open { grid-column: 2; }
  .pdp-applicant-detail dl { grid-template-columns: 1fr; }
  .pdp-applicant-detail dl > div,
  .pdp-applicant-detail dl > div:nth-child(odd),
  .pdp-applicant-detail dl > div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .pdp-applicant-detail dl > div:last-child { border-bottom: 0; }
  .se-application-card { grid-template-columns: 40px minmax(0, 1fr); }
  .se-application-withdraw { grid-column: 2; justify-self: start; padding-left: 0; }
}
    body.login-active .login-card.signup-mode { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
    body.login-active .login-card.signup-mode .login-hero { display: none; }
    body.login-active .login-form.signup-mode > :not(#emailLoginForm) { display: none; }
    body.login-active .login-form.signup-mode { align-content: center; }
    body.login-active { overflow: hidden; }
    body.login-active .login-screen { overflow: auto; }
    body.login-active .login-card { max-height: calc(100dvh - 24px); min-height: 0; }
    body.login-active .login-form { min-height: 0; max-height: calc(100dvh - 24px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
    body.login-active .login-form { border-radius: 30px; }
    body.login-active .login-hero { min-height: 0; }
    @media (max-width: 1400px), (max-height: 920px) {
      body.login-active .login-screen { padding: 10px; overflow: hidden; }
      body.login-active .login-card { width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); grid-template-columns: 1fr; }
      body.login-active .login-hero { display: none; }
      body.login-active .login-form { max-height: calc(100dvh - 20px); overflow: hidden; padding: clamp(14px, 3vw, 24px); gap: 8px; }
      body.login-active .oauth-actions { gap: 6px; }
      body.login-active .oauth-button { min-height: 42px; }
      body.login-active .temporary-login { gap: 6px; padding-top: 8px; }
      body.login-active .temporary-login-fields { gap: 6px; }
      body.login-active .temporary-login .control,
      body.login-active .temporary-login .btn { min-height: 38px; }
      body.login-active .auth-privacy { margin: 4px 0; }
      body.login-active .auth-legal-links { margin: 2px 0; }
      body.login-active .email-auth-actions { display: grid; gap: 10px; margin-top: 8px; }
      body.login-active .email-auth-actions .btn[type="submit"] { background: var(--brand); color: #fff; border-color: var(--brand); }
      body.login-active .email-auth-actions .btn.secondary { margin-top: 4px; }
      body.login-active .remember-login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
      body.login-active .remember-login-row .remember-login { margin: 0; }
      body.login-active .remember-login-row .forgot-password-link { padding: 0; min-height: 44px; border: 0; background: transparent; color: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; box-shadow: none; }
      body.login-active .login-form.signup-mode .email-auth-actions { margin-top: 12px; }
      body.login-active .login-form.signup-mode .email-auth-actions .btn.secondary { margin-top: 2px; }
      body.login-active .login-form.signup-mode #emailLoginForm { display: flex; flex-direction: column; }
      body.login-active .login-form.signup-mode #emailLoginForm .email-auth-actions { display: contents; }
      body.login-active .login-form.signup-mode #emailLoginForm .email-auth-actions .btn[type="submit"] { width: 100%; }
      /* Keep secondary legal copy below the email form instead of interrupting the sign-in controls. */
      body.login-active .login-form { display: flex; flex-direction: column; }
      body.login-active .login-form > .email-login { order: 1; }
      body.login-active .login-form > .auth-privacy { order: 8; }
      body.login-active .login-form > .auth-legal-links { order: 9; }
      body.login-active .login-form > .auth-status { order: 10; }
    body.login-active .login-form.signup-mode > .email-login { order: 1; }
      @media (max-width: 720px) {
        /* Let iOS resize/scroll the login page naturally when AutoFill or the keyboard opens. */
        body.login-active,
        body.login-active #root {
          position: static !important;
          inset: auto !important;
          height: auto !important;
          min-height: 100svh !important;
          overflow: visible !important;
          overscroll-behavior: auto !important;
        }
        body.login-active .login-screen,
        body.login-active .login-form {
          height: auto !important;
          max-height: none !important;
          min-height: 100svh;
          overflow-y: auto !important;
          overscroll-behavior: contain;
        }
        body.login-active .login-screen {
          position: relative !important;
          inset: auto !important;
          min-height: 100svh;
          align-items: flex-start;
          padding-top: calc(16px + env(safe-area-inset-top, 0px));
          padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        }
        body.login-active .login-card {
          height: auto !important;
          max-height: none;
          overflow: visible !important;
        }
        body.login-active .login-card.signup-mode {
          align-self: center;
          margin-top: 12px;
          margin-bottom: 24px;
        }
        body.login-active .login-form {
          min-height: 0;
          max-height: none;
          overflow-x: hidden;
          overflow-y: auto;
          align-content: start;
          padding-bottom: calc(24px + env(safe-area-inset-bottom));
          -webkit-overflow-scrolling: touch;
        }
      }
    }
    /* Messages: one consolidated, responsive layout. Mobile keyboard offset is
       tracked via --chat-viewport-height/--chat-viewport-top, set by
       syncChatViewportVars(), defined later in the main script. Safe-area padding
       reuses the app-wide --mobile-safe-* custom properties. */
    body.chat-active .bottom-nav,
    body.chat-active .topbar { display: none !important; }
    body.connection-flow-active .topbar-map-button,
    body.connection-flow-active .topbar-whatsapp-button,
    body.connection-flow-active .topbar .notify-button[data-route="notifications"] { display: none !important; }
    body.connection-flow-active .topbar { display: flex !important; }
    body.connection-flow-active .bottom-nav { display: none !important; }
    @media (max-width: 859.98px) {
      body.connection-flow-active .topbar { display: none !important; }
      body.connection-flow-active .main { padding-top: 0 !important; }
    }
    @media (max-width: 859.98px) {
      body.connection-flow-active .connection-flow {
        padding-inline: clamp(16px, 7.2vw, 54px);
      }
      body.connection-flow-active .flow-header,
      body.connection-flow-active .flow-hero,
      body.connection-flow-active .flow-steps,
      body.connection-flow-active .flow-footnote {
        width: 100%;
        margin-inline: 0;
      }
      body.connection-flow-active .flow-header {
        padding-inline: 0;
      }
    }
    body.chat-active .content:has(.chat-page) { padding: 0; overflow: hidden; animation: none !important; will-change: auto !important; }
    .chat-page {
      position: fixed;
      top: var(--chat-viewport-top, 0px);
      left: 0;
      right: 0;
      /* 100vh, not 100dvh: a var() whose fallback the engine cannot parse is
         invalid at computed-value time and drops height to `auto`. This page is
         what bounds the message list, so on a dvh-less engine the list lost its
         height and stopped scrolling entirely. @supports upgrades the unit
         where it is understood. */
      height: var(--chat-viewport-height, 100vh);
      width: 100%;
      overflow: hidden;
      background: var(--bg);
    }
    @supports (height: 100dvh) {
      .chat-page { height: var(--chat-viewport-height, 100dvh); }
    }
    .chat-join-required.card {
      display: grid;
      align-content: start;
      justify-items: stretch;
      gap: 14px;
      height: 100%;
      padding: max(18px, var(--mobile-safe-top)) 24px calc(24px + var(--mobile-safe-bottom));
      overflow-y: auto;
      background: var(--bg);
    }
    .teams-command-center { min-height: 100%; overflow-y: auto; padding: max(20px, var(--mobile-safe-top)) 20px calc(28px + var(--mobile-safe-bottom)); background: var(--bg); }
    .teams-command-header, .teams-command-project, .teams-command-section, .teams-command-actions { width: min(100%, 680px); margin-inline: auto; }
    .teams-command-header { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
    .teams-command-back { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-container-lowest); color: var(--ink); font-size: 20px; }
    .teams-command-center { position: relative; min-height: 100dvh; overflow-y: auto; overscroll-behavior-y: contain; padding: 0 20px max(28px, var(--mobile-safe-bottom)); }
    .app:has(.teams-command-center) .content { min-height: 0; height: 100dvh; overflow: hidden; padding: 0 !important; }
    .app:has(.teams-command-center) .teams-command-center { height: 100%; min-height: 0; overflow-y: auto; }
    .teams-command-header { position: sticky; top: 0; z-index: 8; width: min(100%, 680px); min-height: 82px; margin-inline: auto; padding: max(16px, var(--mobile-safe-top)) 0 14px; background: color-mix(in srgb, var(--bg) 94%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 84%, transparent); backdrop-filter: blur(14px); }
    .teams-command-back { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-container-lowest); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }
    .teams-command-back:hover, .teams-command-back:focus-visible { background: var(--surface-container-low); border-color: var(--brand); }
    .teams-command-header h1 { margin: 2px 0 0; font-size: clamp(21px, 5vw, 30px); letter-spacing: -.035em; }
    .teams-command-header .pill { white-space: nowrap; }
    .teams-command-project { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-top: 28px; padding: 24px; border-radius: 22px; background: var(--brand); color: #fff; box-shadow: 0 18px 40px rgba(0,55,35,.18); }
    .teams-command-project small { opacity: .72; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
    .teams-command-project h2 { margin: 8px 0 6px; font-size: clamp(25px, 7vw, 42px); letter-spacing: -.05em; }
    .teams-command-project p { max-width: 42ch; margin: 0; color: rgba(255,255,255,.78); line-height: 1.5; }
    .teams-command-project-mark { display: grid; place-items: center; width: 58px; height: 58px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.22); border-radius: 18px; color: #fff; }
    .teams-command-project-mark svg { width: 30px; height: 30px; }
    .teams-command-section, .teams-command-actions { margin-top: 28px; }
    .teams-command-section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; }
    .teams-command-section h2, .teams-command-actions h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -.025em; }
    .teams-command-count { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--surface-container-lowest); color: var(--brand); font-weight: 800; }
    .teams-command-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
    .teams-person-card { display: flex; align-items: center; gap: 11px; min-height: 72px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-container-lowest); }
    .teams-person-card small { display: block; color: var(--muted); font-size: 11px; }
    .teams-person-card strong { display: block; margin-top: 3px; color: var(--ink); font-size: 14px; }
    .teams-person-avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; background: color-mix(in srgb, var(--brand) 12%, var(--surface-container-lowest)); color: var(--brand); font-weight: 800; }
    .teams-person-lead { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
    .teams-empty-people { display: flex; align-items: center; gap: 12px; padding: 17px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }
    .teams-empty-people p { margin: 0; line-height: 1.45; font-size: 13px; }
    .teams-empty-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px color-mix(in srgb, var(--amber) 14%, transparent); }
    .teams-command-actions { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-container-lowest); }
    .teams-command-action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
    .teams-command-action { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 13px; font-weight: 800; text-decoration: none; }
    .teams-command-action.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
    .teams-command-action.secondary { background: var(--surface-container-lowest); color: var(--brand); }
    .teams-command-whatsapp { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 10px 13px; border: 1px solid color-mix(in srgb, #25D366 40%, var(--line)); border-radius: 13px; background: color-mix(in srgb, #25D366 8%, var(--surface-container-lowest)); color: #168b45; font-weight: 800; text-decoration: none; }
    .teams-command-whatsapp svg { width: 18px; height: 18px; }
    .teams-command-whatsapp.muted { border-color: var(--line); background: var(--surface-container-lowest); color: var(--muted); }
    .teams-person-remove, .teams-person-actions { display: none; }
    .teams-person-lead:has(~ .teams-person-remove) .teams-person-remove,
    .teams-person-card:not(.teams-person-lead) .teams-person-remove,
    .teams-person-pending .teams-person-actions { display: flex; }
    .teams-person-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-container-lowest); color: var(--danger); font-size: 18px; font-weight: 700; cursor: pointer; }
    .teams-person-remove:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface-container-lowest)); border-color: var(--danger); }
    .teams-person-pending { position: relative; padding-right: 70px; }
    .teams-person-date { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
    .teams-person-actions { gap: 6px; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
    .teams-person-action { width: 28px; height: 28px; padding: 0; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; border: 1px solid var(--line); background: var(--surface-container-lowest); }
    .teams-person-action.approve { color: #10b981; }
    .teams-person-action.approve:hover { background: color-mix(in srgb, #10b981 10%, var(--surface-container-lowest)); border-color: #10b981; }
    .teams-person-action.decline { color: #ef4444; }
    .teams-person-action.decline:hover { background: color-mix(in srgb, #ef4444 10%, var(--surface-container-lowest)); border-color: #ef4444; }
    @media (max-width: 520px) { .teams-command-center { padding-inline: 16px; } .teams-command-header { min-height: 74px; padding-top: max(12px, var(--mobile-safe-top)); } .teams-command-project { margin-top: 22px; padding: 20px; } .teams-command-action-row { grid-template-columns: 1fr; } .teams-person-pending { padding-right: 12px; } .teams-person-actions { right: 0; gap: 4px; } .teams-person-action { width: 24px; height: 24px; font-size: 14px; } }
    .teams-map-first { position: fixed; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: #dfe9e3; overflow: hidden; }
    .teams-map-canvas { position: relative; min-height: 0; overflow: hidden; background: linear-gradient(135deg, #d8e5de 0%, #edf4ef 48%, #d2e0d8 100%); }
    .teams-map-grid { position: absolute; inset: -20%; opacity: .42; background-image: linear-gradient(35deg, transparent 48%, rgba(60,104,82,.16) 49%, transparent 51%), linear-gradient(125deg, transparent 48%, rgba(60,104,82,.13) 49%, transparent 51%); background-size: 92px 92px, 124px 124px; transform: rotate(-7deg) scale(1.15); }
    .teams-map-topbar { position: absolute; z-index: 3; top: max(16px, var(--mobile-safe-top)); left: 16px; right: 16px; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid rgba(255,255,255,.72); border-radius: 16px; background: rgba(255,255,255,.78); box-shadow: 0 10px 24px rgba(40,74,58,.12); backdrop-filter: blur(12px); }
    .teams-map-topbar > div { display: grid; min-width: 0; gap: 2px; flex: 1; }
    .teams-map-topbar small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    .teams-map-topbar strong { overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
    .teams-map-back { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font-size: 19px; }
    .teams-map-topbar .pill { white-space: nowrap; }
    .teams-map-route { position: absolute; z-index: 1; height: 7px; border-radius: 999px; background: rgba(46,116,77,.22); transform-origin: left center; }
    .teams-map-route-one { width: 78%; top: 56%; left: 5%; transform: rotate(-16deg); }
    .teams-map-route-two { width: 64%; top: 41%; left: 36%; transform: rotate(38deg); }
    .teams-map-node { position: absolute; z-index: 2; width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; background: #e28b35; box-shadow: 0 3px 8px rgba(38,70,52,.26); }
    .teams-map-node.done { background: var(--brand); }
    .teams-map-legend { position: absolute; z-index: 3; left: 16px; bottom: 16px; display: flex; gap: 12px; padding: 9px 11px; border-radius: 11px; background: rgba(255,255,255,.78); color: var(--muted); font-size: 10px; font-weight: 800; backdrop-filter: blur(10px); }
    .teams-map-legend span { display: inline-flex; align-items: center; gap: 5px; }
    .teams-map-legend i { width: 8px; height: 8px; border-radius: 50%; background: #e28b35; }
    .teams-map-legend i.done { background: var(--brand); }
    .teams-map-empty { position: absolute; inset: 35% 20% auto; z-index: 2; padding: 16px; border: 1px dashed rgba(38,70,52,.28); border-radius: 16px; color: #557064; text-align: center; font-size: 12px; line-height: 1.5; }
    .teams-map-sheet { position: relative; z-index: 4; padding: 10px 18px calc(18px + var(--mobile-safe-bottom)); border-radius: 24px 24px 0 0; background: var(--surface-container-lowest); box-shadow: 0 -14px 34px rgba(40,74,58,.14); }
    .teams-map-sheet-handle { width: 38px; height: 4px; margin: 0 auto 15px; border-radius: 99px; background: var(--line); }
    .teams-map-sheet-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
    .teams-map-sheet h1 { margin: 3px 0 0; color: var(--ink); font-size: clamp(22px, 6vw, 30px); letter-spacing: -.04em; }
    .teams-map-sheet > p { max-width: 48ch; margin: 8px 0 15px; color: var(--muted); font-size: 13px; line-height: 1.48; }
    .teams-map-people-count { padding: 7px 9px; border-radius: 10px; background: var(--panel-soft); color: var(--brand); font-size: 11px; font-weight: 800; white-space: nowrap; }
    .teams-map-action-row { display: grid; grid-template-columns: 1fr 48px; gap: 9px; }
    .map-first-action, .map-first-whatsapp { min-height: 46px; border: 1px solid var(--line); border-radius: 13px; font-weight: 800; text-decoration: none; }
    .map-first-action.primary { background: var(--brand); color: #fff; }
    .map-first-action.secondary { background: var(--surface-container-lowest); color: var(--brand); }
    .map-first-whatsapp { display: grid; place-items: center; background: color-mix(in srgb, #25D366 9%, var(--surface-container-lowest)); color: #168b45; }
    .map-first-whatsapp svg { width: 20px; height: 20px; }
    .map-first-whatsapp.muted { background: var(--surface-container-lowest); color: var(--muted); }
    @media (min-width: 860px) { .teams-map-first { grid-template-rows: 1fr; } .teams-map-sheet { position: absolute; left: 24px; bottom: 24px; width: min(420px, calc(100% - 48px)); border-radius: 24px; padding-bottom: 20px; } }
    .team-directory { min-height: 100%; overflow-y: auto; padding: max(20px, var(--mobile-safe-top)) 20px calc(28px + var(--mobile-safe-bottom)); background: var(--bg); }
    .directory-header, .directory-project, .directory-section, .directory-actions { width: min(100%, 680px); margin-inline: auto; }
    .directory-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
    .directory-back, .directory-settings { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-container-lowest); color: var(--ink); }
    .directory-settings svg { width: 18px; height: 18px; }
    .directory-header h1 { margin: 2px 0 0; color: var(--ink); font-size: clamp(22px, 6vw, 32px); letter-spacing: -.045em; }
    .directory-project { margin-top: 28px; padding: 22px; border-bottom: 3px solid var(--brand); background: var(--surface-container-lowest); }
    .directory-project h2 { margin: 6px 0 5px; color: var(--ink); font-size: clamp(24px, 7vw, 38px); letter-spacing: -.05em; }
    .directory-project p { margin: 0; color: var(--muted); line-height: 1.5; }
    .directory-section { margin-top: 28px; }
    .directory-section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
    .directory-section h2, .directory-actions h2 { margin: 3px 0 0; color: var(--ink); font-size: 20px; letter-spacing: -.025em; }
    .directory-count { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--panel-soft); color: var(--brand); font-weight: 800; }
    .directory-roster { display: grid; gap: 9px; }
    .directory-person { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 13px 14px; border: 1px solid var(--line); background: var(--surface-container-lowest); }
    .directory-lead { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
    .directory-avatar { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; background: color-mix(in srgb, var(--brand) 13%, var(--surface-container-lowest)); color: var(--brand); font-size: 14px; font-weight: 800; }
    .directory-person-copy { display: grid; gap: 3px; min-width: 0; flex: 1; }
    .directory-person-copy strong { color: var(--ink); font-size: 15px; }
    .directory-person-copy span { color: var(--muted); font-size: 12px; }
    .directory-person-copy small { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-size: 11px; font-weight: 700; }
    .directory-person-copy small i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
    .directory-more { border: 0; background: transparent; color: var(--muted); font-size: 16px; letter-spacing: 2px; }
    .directory-empty { padding: 28px 20px; border: 1px dashed var(--line); background: var(--surface-container-lowest); text-align: center; }
    .directory-empty-icon { width: 42px; height: 42px; margin: 0 auto 12px; color: var(--brand); }
    .directory-empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 17px; }
    .directory-empty p { max-width: 34ch; margin: auto; color: var(--muted); line-height: 1.5; font-size: 13px; }
    .directory-actions { margin-top: 28px; padding: 20px; border: 1px solid var(--line); background: var(--surface-container-lowest); }
    .directory-action-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 16px; }
    .directory-action, .directory-whatsapp { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; font-weight: 800; text-decoration: none; }
    .directory-action.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
    .directory-action.secondary { background: var(--surface-container-lowest); color: var(--brand); }
    .directory-whatsapp { width: 48px; background: color-mix(in srgb, #25D366 9%, var(--surface-container-lowest)); color: #168b45; }
    .directory-whatsapp span { display: none; }
    .directory-whatsapp svg { width: 19px; height: 19px; }
    .directory-whatsapp.muted { background: var(--surface-container-lowest); color: var(--muted); }
    @media (max-width: 520px) { .team-directory { padding-inline: 16px; } .directory-project { margin-top: 22px; padding: 20px; } }
    @media (display-mode: standalone), (display-mode: fullscreen) {
      .teams-workspace-bar { padding-top: max(44px, calc(var(--mobile-safe-top) + 12px)); }
    }
    .connection-flow { min-height: 100%; overflow-y: auto; padding: max(20px, var(--mobile-safe-top)) 20px calc(28px + var(--mobile-safe-bottom)); background: var(--bg); }
    .flow-header, .flow-hero, .flow-steps, .flow-footnote { width: min(100%, 620px); margin-inline: auto; }
    .flow-header { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; width: auto; margin-inline: -20px; padding: max(4px, var(--mobile-safe-top)) 20px 14px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); }
    .flow-back { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-container-lowest); color: var(--ink); font-size: 19px; }
    .flow-header h1 { margin: 3px 0 0; color: var(--ink); font-size: clamp(23px, 6vw, 34px); letter-spacing: -.045em; }
    .flow-hero { margin-top: 34px; padding: 26px 22px 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-container-lowest); }
    .flow-progress { height: 6px; margin-bottom: 24px; border-radius: 99px; background: var(--panel-soft); overflow: hidden; }
    .flow-progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .25s ease; }
    .flow-hero h2 { margin: 7px 0 8px; color: var(--ink); font-size: clamp(27px, 7vw, 42px); letter-spacing: -.05em; }
    .flow-hero p { max-width: 46ch; margin: 0; color: var(--muted); line-height: 1.55; }
    .flow-hero-action { margin-top: 22px; }
    .join-request-summary { display: grid; gap: 10px; margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--brand) 5%, var(--surface-container-lowest)); }
    .join-request-summary div { display: grid; gap: 3px; }
    .join-request-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
    .join-request-summary strong { color: var(--ink); font-size: 14px; }
    .join-request-summary-list > strong { display: block; margin-bottom: 4px; }
    .join-request-summary-list > div { padding-top: 10px; border-top: 1px solid var(--line); }
    .flow-inline-join { display: grid; gap: 10px; }
    .flow-code-input { width: 100%; height: 48px; min-height: 48px; box-sizing: border-box; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-container-lowest); color: var(--ink); font-size: 14px; font-weight: 700; letter-spacing: .06em; line-height: 48px; text-align: center; text-transform: uppercase; outline: none; }
    .flow-code-input::placeholder { color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-align: center; opacity: .82; }
    .flow-code-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
    .flow-inline-join .flow-action { height: 48px; min-height: 48px; box-sizing: border-box; padding-block: 0; border: 1px solid var(--brand); border-radius: 13px !important; }
    .flow-inline-join .flow-code-input { border: 1px solid var(--brand); border-radius: 13px !important; }
    .flow-action { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 13px; font-weight: 800; }
    .flow-action.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
    .flow-action.secondary { background: var(--surface-container-lowest); color: var(--brand); }
    .flow-action.danger { background: #b42318; color: #fff; border-color: #b42318; }
    .flow-steps { margin-top: 28px; }
    .flow-steps h3 { margin: 0 0 12px; color: var(--ink); font-size: 18px; }
    .flow-step { display: grid; grid-template-columns: 34px 1fr auto; align-items: start; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); opacity: .55; }
    .flow-step.current, .flow-step.complete { opacity: 1; }
    .flow-step-number { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
    .flow-step.current .flow-step-number { border-color: var(--brand); background: var(--brand); color: #fff; }
    .flow-step.complete .flow-step-number { border-color: var(--green); background: var(--green); color: #fff; }
    .flow-step strong { display: block; margin: 2px 0 4px; color: var(--ink); font-size: 14px; }
    .flow-step p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
    .flow-step small { padding-top: 4px; color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
    .flow-footnote { margin-top: 24px; color: var(--muted); font-size: 11px; line-height: 1.5; }
    @media (max-width: 520px) { .connection-flow { padding-inline: 16px; } .flow-hero { margin-top: 24px; padding: 22px 18px 19px; } .flow-step { grid-template-columns: 32px 1fr; } .flow-step small { grid-column: 2; padding-top: 0; } .flow-action { width: 100%; } }
    .teams-inbox { min-height: 100%; overflow-y: auto; padding: max(20px, var(--mobile-safe-top)) 20px calc(28px + var(--mobile-safe-bottom)); background: var(--bg); }
    .inbox-header, .inbox-tabs, .inbox-body { width: min(100%, 680px); margin-inline: auto; }
    .inbox-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
    .inbox-back { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-container-lowest); color: var(--ink); font-size: 19px; }
    .inbox-header h1 { margin: 3px 0 0; color: var(--ink); font-size: clamp(22px, 6vw, 32px); letter-spacing: -.045em; }
    .inbox-badge { padding: 7px 9px; border-radius: 10px; background: var(--panel-soft); color: var(--brand); font-size: 11px; font-weight: 800; white-space: nowrap; }
    .inbox-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 26px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-container-lowest); }
    .inbox-tab { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
    .inbox-tab.active { background: var(--brand); color: #fff; box-shadow: 0 5px 12px rgba(0,55,35,.14); }
    .inbox-body { margin-top: 18px; }
    .inbox-project-hero { position: relative; padding: 25px 22px; border-radius: 22px; background: var(--brand); color: #fff; overflow: hidden; }
    .inbox-project-hero::after { content: ''; position: absolute; width: 180px; height: 180px; right: -72px; bottom: -98px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 24px rgba(255,255,255,.05), 0 0 0 48px rgba(255,255,255,.04); }
    .inbox-project-hero .eyebrow { color: rgba(255,255,255,.72); }
    .inbox-project-hero h2 { position: relative; z-index: 1; margin: 8px 0 6px; font-size: clamp(27px, 7vw, 42px); letter-spacing: -.05em; }
    .inbox-project-hero p { position: relative; z-index: 1; max-width: 42ch; margin: 0; color: rgba(255,255,255,.78); line-height: 1.5; }
    .inbox-project-status { position: relative; z-index: 1; display: inline-flex; margin-top: 18px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.16); color: #fff; font-size: 11px; font-weight: 800; }
    .inbox-project-actions { margin-top: 14px; }
    .inbox-action { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 13px; font-weight: 800; text-decoration: none; }
    .inbox-action.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
    .inbox-action.secondary { background: var(--surface-container-lowest); color: var(--brand); }
    .inbox-tab-empty, .inbox-channel-card { padding: 30px 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-container-lowest); text-align: center; }
    @media (max-width: 859.98px) {
      body.chat-active .teams-inbox {
        min-height: 0;
        height: 100%;
        overflow: hidden;
        padding: 12px 20px calc(16px + var(--mobile-safe-bottom));
      }
      body.chat-active .teams-inbox .inbox-tabs { margin-top: 16px; }
      body.chat-active .teams-inbox .inbox-body { margin-top: 12px; }
      body.chat-active .teams-inbox .inbox-tab-empty,
      body.chat-active .teams-inbox .inbox-channel-card { padding: 20px 16px; }
    }
    .inbox-tab-empty h2, .inbox-channel-card h2 { margin: 0 0 8px; color: var(--ink); font-size: 20px; }
    .inbox-tab-empty p, .inbox-channel-card p { max-width: 38ch; margin: 0 auto 18px; color: var(--muted); line-height: 1.5; font-size: 13px; }
    .inbox-people-list { display: grid; gap: 8px; }
    .inbox-person { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-container-lowest); }
    .inbox-person > div:nth-child(2) { display: grid; gap: 3px; flex: 1; }
    .inbox-person strong { color: var(--ink); font-size: 14px; }
    .inbox-person span { color: var(--muted); font-size: 12px; }
    .inbox-person > i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
    .inbox-channel-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; background: color-mix(in srgb, #25D366 10%, var(--surface-container-lowest)); color: #168b45; }
    .inbox-channel-icon svg { width: 27px; height: 27px; }
    @media (max-width: 520px) { .teams-inbox { padding-inline: 16px; } .inbox-tab { font-size: 10px; } .inbox-project-hero { padding: 22px 18px; } }

    /* ===== Teams, split by role =========================================
       PM sees a command deck: an invite lever, an approval queue, a roster
       they manage. The Site Engineer sees a crew card: who they answer to,
       who they work beside, one way out. Two jobs, two surfaces. */
    .pm-teams, .crew { --teams-w: min(100%, 660px); }
    .pm-teams > *, .crew > * { width: var(--teams-w); margin-inline: auto; }

    /* --- shared header --- */
    .teams-role-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 22px; }
    .teams-role-back { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-container-lowest); color: var(--ink); }
    .teams-role-back svg { width: 18px; height: 18px; }
    .teams-role-head h1 { margin: 0; color: var(--ink); font-size: clamp(21px, 5.4vw, 27px); letter-spacing: -.045em; line-height: 1.05; }
    .teams-role-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
    .teams-role-tag { padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }

    /* Keep the Teams back control in the same top rhythm as the app topbar. */
    .pm-teams > .teams-role-head, .crew > .teams-role-head {
      width: calc(100% + 52px);
      min-height: 64px;
      margin: -26px -26px 18px;
      padding: 12px 26px;
    }

    @media (max-width: 980px) {
      .pm-teams > .teams-role-head, .crew > .teams-role-head {
        width: calc(100% + 20px);
        margin: -16px -10px 18px;
        padding: 10px 18px;
      }
    }
    @media (max-width: 430px) {
      .pm-teams > .teams-role-head, .crew > .teams-role-head {
        width: calc(100% + 16px);
        margin-inline: -8px;
      }
    }

    /* --- PM: invite hero --- */
    .pm-hero { position: relative; padding: 22px; border-radius: 24px; background: linear-gradient(158deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 78%, #04121f) 100%); color: #fff; overflow: hidden; box-shadow: 0 22px 44px -20px rgba(4,20,35,.6); }
    body.dark .pm-hero { background: linear-gradient(158deg, #16463a 0%, #0d2e26 100%); box-shadow: 0 22px 44px -22px rgba(0,0,0,.7); }
    .pm-hero::after { content: ''; position: absolute; inset: auto -80px -110px auto; width: 220px; height: 220px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 0 0 26px rgba(255,255,255,.05), 0 0 0 52px rgba(255,255,255,.035); pointer-events: none; }
    .pm-hero-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
    .pm-hero-top h2 { margin: 0; font-size: clamp(26px, 6.4vw, 36px); letter-spacing: -.05em; line-height: 1.02; }
    .pm-hero-live { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; color: rgba(255,255,255,.82); font-size: 12.5px; font-weight: 600; }
    .pm-hero-live i { width: 7px; height: 7px; border-radius: 50%; background: #7bed9f; box-shadow: 0 0 0 4px rgba(123,237,159,.22); }
    .pm-hero-tag { background: rgba(255,255,255,.18); color: #fff; }
    .pm-code { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px 14px; margin-top: 22px; padding: 14px 15px; border-radius: 15px; background: rgba(255,255,255,.1); border: 1px dashed rgba(255,255,255,.34); }
    .pm-code-label { grid-column: 1 / -1; color: rgba(255,255,255,.66); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
    .pm-code-value { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace; font-size: clamp(23px, 6vw, 30px); font-weight: 700; letter-spacing: .18em; color: #fff; }
    .pm-code-copy { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 16px; border-radius: 11px; background: #fff; color: var(--brand); font-weight: 800; font-size: 13px; }
    body.dark .pm-code-copy { color: #0d2e26; }
    .pm-code-copy svg { width: 16px; height: 16px; }
    .pm-code-hint { margin: 10px 2px 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

    /* --- PM: approval queue --- */
    .pm-queue { margin-top: 24px; }
    .pm-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 12px; }
    .pm-section-head h3 { margin: 0; color: var(--ink); font-size: 16px; letter-spacing: -.02em; }
    .pm-section-head span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
    .pm-queue-card { display: grid; gap: 13px; padding: 15px; border-radius: 17px; background: var(--surface-container-lowest); border: 1px solid color-mix(in srgb, var(--amber) 42%, var(--line)); box-shadow: 0 12px 26px -20px rgba(20,20,20,.5); }
    .pm-queue-card + .pm-queue-card { margin-top: 10px; }
    .pm-req { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; }
    .pm-req-avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand-2) 20%, var(--surface-container-lowest)); color: var(--brand-2); font-weight: 800; font-size: 14px; }
    .pm-req-who strong { display: block; color: var(--ink); font-size: 14.5px; letter-spacing: -.01em; }
    .pm-req-who span { color: var(--muted); font-size: 12.5px; }
    .pm-req-kind { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; font-weight: 700; }
    .pm-req-kind.join { color: var(--brand-2); }
    .pm-req-kind.leave { color: var(--red); }
    .pm-req-kind i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
    .pm-req-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
    .pm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border-radius: 12px; font-weight: 800; font-size: 13.5px; border: 1px solid var(--line); background: var(--surface-container-lowest); color: var(--ink); transition: transform .16s ease, background .16s ease, border-color .16s ease; }
    .pm-btn svg { width: 17px; height: 17px; }
    .pm-btn:active { transform: scale(.97); }
    .pm-btn.approve { border-color: transparent; background: var(--brand-2); color: #fff; }
    body.dark .pm-btn.approve { color: #08211a; }
    .pm-btn.approve:hover { background: color-mix(in srgb, var(--brand-2) 88%, #000); }
    body.dark .pm-btn.approve:hover { background: color-mix(in srgb, var(--brand-2) 84%, #fff); }
    .pm-btn.decline:hover { border-color: var(--red); color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--surface-container-lowest)); }
    .pm-req-actions.single { grid-template-columns: 1fr; }

    /* --- PM roster --- */
    .pm-roster { margin-top: 26px; }
    .pm-role-block + .pm-role-block { margin-top: 20px; }
    .pm-role-label { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
    .pm-role-label b { color: var(--ink); }
    .pm-member { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 14px; background: var(--surface-container-lowest); border: 1px solid var(--line); }
    .pm-member + .pm-member { margin-top: 8px; }
    .pm-member-avatar { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
    .pm-member-avatar.lead { background: var(--brand); color: #fff; }
    body.dark .pm-member-avatar.lead { color: #08211a; }
    .pm-member-avatar.crew { background: var(--surface-variant); color: var(--brand-2); }
    .pm-member-name { min-width: 0; }
    .pm-member-name strong { display: block; color: var(--ink); font-size: 14.5px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pm-member-name span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
    .pm-member-name span i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
    .pm-member-remove { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); transition: color .16s ease, border-color .16s ease, background .16s ease; }
    .pm-member-remove:hover { color: var(--red); border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
    .pm-member-remove svg { width: 17px; height: 17px; }

    /* --- shared WhatsApp row --- */
    .teams-wa { display: flex; align-items: center; gap: 13px; margin-top: 24px; padding: 15px; border-radius: 16px; background: var(--surface-container-lowest); border: 1px solid var(--line); text-decoration: none; color: inherit; }
    .teams-wa-icon { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, #25D366 14%, var(--surface-container-lowest)); color: #128c40; }
    body.dark .teams-wa-icon { color: #4ee38a; }
    .teams-wa-icon svg { width: 24px; height: 24px; }
    .teams-wa-copy { flex: 1; min-width: 0; }
    .teams-wa-copy strong { display: block; color: var(--ink); font-size: 14.5px; letter-spacing: -.01em; }
    .teams-wa-copy span { color: var(--muted); font-size: 12.5px; }
    .teams-wa-go { flex: none; color: var(--muted); }
    .teams-wa-go svg { width: 20px; height: 20px; }

    /* --- SE: crew hero --- */
    .crew-hero { position: relative; padding: 26px 22px 24px; border-radius: 26px; overflow: hidden; background: radial-gradient(120% 130% at 18% 0%, color-mix(in srgb, var(--brand-2) 20%, var(--surface-container-lowest)) 0%, var(--surface-container-lowest) 62%); border: 1px solid var(--line); }
    .crew-hero-status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: color-mix(in srgb, var(--green) 20%, var(--surface-container-lowest)); color: var(--brand-2); font-size: 12px; font-weight: 800; }
    .crew-hero-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 28%, transparent); }
    .crew-hero h2 { margin: 15px 0 6px; color: var(--ink); font-size: clamp(28px, 8vw, 40px); letter-spacing: -.05em; line-height: 1.02; }
    .crew-hero p { margin: 0; max-width: 32ch; color: var(--muted); font-size: 14px; line-height: 1.5; }
    .crew-hero-pending { display: inline-flex; align-items: center; gap: 8px; margin-top: 15px; padding: 8px 13px; border-radius: 12px; background: color-mix(in srgb, var(--amber) 22%, var(--surface-container-lowest)); color: color-mix(in srgb, var(--amber) 62%, var(--ink)); font-size: 12.5px; font-weight: 700; }

    /* --- SE: your PM --- */
    .crew-lead { display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: center; margin-top: 18px; padding: 18px; border-radius: 20px; background: var(--brand); color: #fff; box-shadow: 0 20px 40px -22px rgba(4,20,35,.6); }
    body.dark .crew-lead { background: linear-gradient(150deg, #16463a, #0e2c24); }
    .crew-lead-avatar { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.18); color: #fff; font-weight: 800; font-size: 18px; }
    .crew-lead-role { color: rgba(255,255,255,.66); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
    .crew-lead-name { margin: 3px 0 0; font-size: 20px; letter-spacing: -.03em; }
    .crew-lead-note { margin: 4px 0 0; color: rgba(255,255,255,.72); font-size: 12.5px; }

    /* --- SE: crewmates --- */
    .crew-mates { margin-top: 24px; }
    .crew-mates h3 { margin: 0 2px 12px; color: var(--ink); font-size: 16px; letter-spacing: -.02em; }
    .crew-mate { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 15px; background: var(--surface-container-lowest); border: 1px solid var(--line); }
    .crew-mate + .crew-mate { margin-top: 9px; }
    .crew-mate-avatar { flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-variant); color: var(--brand-2); font-weight: 800; font-size: 14px; }
    .crew-mate-name { flex: 1; min-width: 0; }
    .crew-mate-name strong { display: block; color: var(--ink); font-size: 14.5px; letter-spacing: -.01em; }
    .crew-mate-name span { color: var(--muted); font-size: 12.5px; }
    .crew-mate-you { flex: none; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--brand-2) 22%, var(--surface-container-lowest)); color: var(--brand-2); font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
    .crew-empty { padding: 26px 20px; border-radius: 18px; border: 1px dashed var(--line); background: var(--surface-container-lowest); text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
    .crew-leave { display: block; width: 100%; min-height: 48px; margin-top: 26px; border-radius: 14px; background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 13.5px; transition: color .16s ease, border-color .16s ease; }
    .crew-leave:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }

    @media (max-width: 520px) {
      .pm-hero, .crew-hero { border-radius: 22px; }
      .pm-code-value { letter-spacing: .12em; }
      .crew-hero { padding: 22px 18px; }
    }

    .chat-join-required > * { width: min(100%, 410px); margin-inline: auto; }
    .chat-join-required .chat-join-back {
      width: auto !important;
      justify-self: start;
      margin-inline: max(0px, calc((100% - 410px) / 2));
      min-height: 38px;
      padding: 8px 13px;
      border-radius: 11px;
      box-shadow: none;
    }
    .chat-join-required .chat-join-icon {
      width: 48px;
      height: 48px;
      display: grid;
      place-items: center;
      padding: 11px;
      border-radius: 14px;
      background: color-mix(in srgb, var(--brand) 10%, var(--surface-container-lowest));
      color: var(--brand);
    }
    .chat-join-required h1 { margin: 8px auto 0; font-size: clamp(25px, 7vw, 34px); letter-spacing: -.035em; }
    .chat-join-kicker { width: min(100%, 410px); margin-inline: auto; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
    .chat-join-required p { max-width: 36ch; margin: 0 auto; color: var(--muted); line-height: 1.55; }
    .chat-join-required > .btn.primary { width: min(100%, 410px) !important; min-height: 46px; margin-top: 8px; border-radius: 13px; box-shadow: 0 10px 20px rgba(25, 75, 116, .16); }
    .project-pass-panel { width: min(100%, 430px); margin: auto; display: grid; gap: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-container-lowest); box-shadow: 0 18px 46px rgba(20, 42, 34, .12); }
    .project-pass-panel > * { width: 100%; margin-inline: 0; }
    .project-pass-panel .chat-join-back { order: -3; justify-self: start; width: fit-content !important; margin: 0; }
    .project-pass-panel .chat-join-icon { order: -2; }
    .project-pass-panel .chat-join-kicker { order: -1; }
    .project-pass-panel h1 { margin-top: 0; }
    .project-pass-panel p { max-width: 34ch; }
    .project-pass-panel > .btn.primary { margin-top: 8px; }
    @media (max-width: 520px) {
      .chat-join-required { padding-inline: 18px; }
      .chat-join-required .chat-join-back { margin-inline: 0; }
      .project-pass-panel { padding: 20px; border-radius: 20px; }
    }
    .chat-join-icon { width: 42px; height: 42px; color: var(--brand); }
    .chat-shell {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      height: 100%;
      min-height: 0;
      background: var(--surface-container-lowest);
    }
    @media (min-width: 860px) {
      .chat-shell { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
    }
    @media (max-width: 859.98px) {
      .chat-shell:not(.thread-open) .chat-thread { display: none; }
      .chat-shell.thread-open .chat-sidebar { display: none; }
    }
    .chat-sidebar,
    .chat-thread { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
    .chat-sidebar { border-right: 1px solid var(--line); }
    .teams-workspace-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--brand) 5%, var(--surface-container-lowest)); }
    .teams-workspace-bar > div { min-width: 0; display: grid; gap: 2px; }
    .teams-workspace-bar .eyebrow { color: var(--brand); font-size: 10px; letter-spacing: .1em; }
    .teams-workspace-bar strong, .teams-workspace-bar small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .teams-workspace-bar strong { color: var(--ink); font-size: 14px; }
    .teams-workspace-bar small { color: var(--muted); font-size: 11px; }
    .teams-whatsapp-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; min-height: 36px; padding: 8px 10px; border: 1px solid color-mix(in srgb, #25D366 38%, var(--line)); border-radius: 11px; background: color-mix(in srgb, #25D366 9%, var(--surface-container-lowest)); color: #168b45; font-size: 11px; font-weight: 800; text-decoration: none; }
    .teams-whatsapp-link svg { width: 17px; height: 17px; }
    .teams-whatsapp-link.muted { color: var(--muted); border-color: var(--line); background: var(--surface-container-lowest); }
    @media (max-width: 859.98px) { .teams-workspace-bar { padding-top: max(44px, calc(var(--mobile-safe-top) + 12px)); } .teams-whatsapp-link span { display: none; } .teams-whatsapp-link { width: 38px; padding: 8px; } }
    .chat-sidebar-head {
      flex: none;
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: max(12px, var(--mobile-safe-top)) 16px 12px;
      border-bottom: 1px solid var(--line);
      background: var(--surface-container-lowest);
    }
    .chat-sidebar-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
    .chat-sidebar-title h1 { margin: 0; font-size: 20px; }
    .chat-list-back {
      align-self: flex-start;
      display: inline-flex;
      align-items: center;
      gap: 7px;
      min-height: 38px;
      padding: 7px 13px;
      border-radius: 999px;
      color: var(--brand-2);
      background: var(--surface-container-low);
      font-weight: 700;
      border: 0;
    }
    .chat-conversation-items { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 10px 12px; }
    .chat-conversation {
      display: grid;
      grid-template-columns: 46px minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
      width: 100%;
      min-height: 68px;
      padding: 9px 8px;
      border: 0;
      border-radius: 14px;
      background: transparent;
      text-align: left;
      color: inherit;
    }
    .chat-conversation:hover,
    .chat-conversation.active { background: color-mix(in srgb, var(--surface-container-low) 72%, transparent); }
    .chat-avatar {
      display: grid;
      place-items: center;
      width: 46px;
      height: 46px;
      border-radius: 999px;
      background: var(--surface-container-low);
      color: var(--ink);
      font-weight: 700;
      font-size: 13px;
      flex: none;
    }
    .chat-avatar.photo { background-size: cover; background-position: center; background-repeat: no-repeat; }
    .chat-avatar.group { background: var(--brand); color: var(--surface-container-lowest); }
    .chat-conversation-copy,
    .chat-thread-title { min-width: 0; }
    .chat-conversation-name,
    .chat-conversation-preview,
    .chat-thread-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .chat-conversation-name { font-weight: 700; font-size: 14px; }
    .chat-conversation-preview { color: var(--muted); font-size: 12px; margin-top: 2px; }
    .chat-conversation-meta { display: grid; justify-items: end; gap: 6px; color: var(--muted); font-size: 11px; }
    .chat-unread-badge {
      min-width: 19px;
      height: 19px;
      padding: 0 6px;
      display: inline-grid;
      place-items: center;
      border-radius: 999px;
      background: var(--brand-2);
      color: #fff;
      font-size: 11px;
      font-weight: 700;
    }
    .chat-thread { grid-template-rows: auto minmax(0, 1fr) auto; }
    .chat-thread-head {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: none;
      padding: max(12px, var(--mobile-safe-top)) 16px 12px;
      border-bottom: 1px solid var(--line);
      background: var(--surface-container-lowest);
    }
    .chat-back {
      display: none;
      width: 40px;
      min-width: 40px;
      height: 40px;
      padding: 0;
      align-items: center;
      justify-content: center;
      flex: none;
      border: 0;
      background: transparent;
      color: var(--brand-2);
      border-radius: 999px;
      font-size: 20px;
      line-height: 1;
    }
    .chat-back::before { content: ""; width: 10px; height: 10px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
    @media (max-width: 859.98px) { .chat-back { display: inline-flex; } }
    .chat-thread-title-button { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
    .chat-thread-title small { display: block; color: var(--muted); margin-top: 2px; font-style: normal; }
    .chat-head-tool,
    .chat-mention-button {
      display: grid;
      place-items: center;
      width: 38px;
      height: 38px;
      flex: 0 0 38px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: var(--surface-container-low);
      color: var(--ink);
      font-weight: 700;
    }
    .chat-sync-state { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
    .chat-tools-panel {
      position: absolute;
      z-index: 8;
      top: 62px;
      right: 12px;
      width: min(340px, calc(100% - 24px));
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: var(--panel);
      box-shadow: 0 18px 42px rgba(0, 0, 0, .18);
    }
    .chat-tools-row,
    .chat-mute-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
    .chat-member-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
    .chat-mute-row { margin-top: 12px; }
    .chat-mute-row .btn { min-height: 34px; padding: 6px 10px; border-radius: 999px; }
    .chat-rename-form { display: grid; gap: 7px; margin-top: 12px; }
    .chat-rename-form > label { font-weight: 700; }
    .chat-rename-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 7px; align-items: center; }
    .chat-rename-controls .control { min-width: 0; min-height: 44px; }
    .chat-rename-controls .btn { min-height: 44px; padding: 8px 12px; white-space: nowrap; }
    .chat-message-stream {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      padding: 16px;
      background: var(--bg);
    }
    .chat-day { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 11px; }
    .chat-day::before,
    .chat-day::after { content: ""; height: 1px; flex: 1; background: var(--line); }
    .chat-message-row { display: flex; align-items: flex-end; gap: 8px; margin: 8px 0; min-width: 0; }
    .chat-message-row.mine { justify-content: flex-end; }
    .chat-message-row.mine .chat-avatar { display: none; }
    .chat-bubble-wrap { max-width: min(78%, 680px); min-width: 0; }
    .chat-sender { margin: 0 0 4px 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
    .chat-bubble { padding: 10px 13px; border-radius: 18px 18px 18px 5px; background: var(--surface-container-lowest); color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
    .chat-message-row.mine .chat-bubble { border-radius: 18px 18px 5px 18px; background: var(--brand); color: #fff; }
    .chat-message-meta { display: flex; align-items: center; gap: 7px; margin-top: 4px; color: var(--muted); font-size: 10px; }
    .chat-message-row.mine .chat-message-meta { justify-content: flex-end; }
    .chat-status.failed { color: var(--red); }
    .chat-status.pending { color: var(--muted); }
    .chat-status.delivery-seen { color: var(--brand-2); font-weight: 700; }
    .chat-status.delivery-sent { color: var(--muted); }
    .chat-retry { border: 0; padding: 0; background: transparent; color: var(--red); font: inherit; font-weight: 700; text-decoration: underline; }
    .chat-group-readers { display: flex; gap: 2px; margin-top: 3px; justify-content: flex-end; }
    .chat-read-avatar {
      width: 14px;
      height: 14px;
      border-radius: 999px;
      background: var(--surface-container-low) center/cover no-repeat;
      display: inline-grid;
      place-items: center;
      font-size: 8px;
      font-weight: 700;
      color: var(--muted);
    }
    .chat-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; color: var(--muted); text-align: center; }
    .chat-empty svg { width: 42px; height: 42px; color: var(--brand); }
    .list-empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--muted); text-align: center; }
    .list-empty svg { width: 34px; height: 34px; color: var(--outline-variant); }
    .list-empty p { margin: 0; font-size: 13px; }
    .chat-composer {
      display: grid;
      grid-template-columns: 40px minmax(0, 1fr) auto;
      align-items: end;
      gap: 8px;
      flex: none;
      padding: 8px 12px max(8px, var(--mobile-safe-bottom));
      border-top: 1px solid var(--line);
      background: var(--surface-container-lowest);
    }
    .chat-composer textarea {
      width: 100%;
      min-width: 0;
      min-height: 42px;
      max-height: 120px;
      resize: none;
      line-height: 1.4;
      border-radius: 22px;
      padding: 10px 14px;
      font-size: 16px;
      background: var(--surface-container-low);
    }
    .chat-send { min-width: 70px; border-radius: 999px; }
    .chat-notification-link { width: 100%; cursor: pointer; color: var(--ink); text-align: left; }
    .chat-notification-link:hover { border-color: var(--brand); }
    body.dark .chat-message-stream { background: var(--bg); }
    body.dark .chat-message-row.mine .chat-bubble { background: var(--brand); color: #fff; }
    @keyframes chatListExit { from { transform: translate3d(0,0,0); opacity: 1; } to { transform: translate3d(-12%,0,0); opacity: 1; } }
    @keyframes chatThreadEnter { from { transform: translate3d(100%,0,0); opacity: 1; } to { transform: translate3d(0,0,0); opacity: 1; } }
    @keyframes chatListEnter { from { transform: translate3d(-12%,0,0); opacity: 1; } to { transform: translate3d(0,0,0); opacity: 1; } }
    @keyframes chatThreadExit { from { transform: translate3d(0,0,0); opacity: 1; } to { transform: translate3d(100%,0,0); opacity: 1; } }
    #chatShell.chat-slide-opening > .chat-sidebar { animation: chatListExit 180ms cubic-bezier(.12,.92,.18,1) both; }
    #chatShell.chat-slide-opening > .chat-thread { animation: chatThreadEnter 180ms cubic-bezier(.12,.92,.18,1) both; }
    #chatShell.chat-slide-closing > .chat-sidebar { animation: chatListEnter 180ms cubic-bezier(.12,.92,.18,1) both; }
    #chatShell.chat-slide-closing > .chat-thread { animation: chatThreadExit 180ms cubic-bezier(.12,.92,.18,1) both; }
    .bottom-nav button[data-route="chat"].has-notification .bottom-icon { position: relative; }
    .bottom-nav button[data-route="chat"].has-notification .bottom-icon::after {
      content: "";
      position: absolute;
      top: -2px;
      right: -2px;
      width: 9px;
      height: 9px;
      border-radius: 999px;
      background: var(--red);
      border: 2px solid var(--surface-container-lowest);
    }
    body.dark .bottom-nav button[data-route="chat"].has-notification .bottom-icon::after { border-color: var(--panel); }
    @media (prefers-reduced-motion: reduce) {
      .chat-shell, .chat-thread, .chat-message-stream { scroll-behavior: auto; }
      #chatShell.chat-slide-opening > .chat-sidebar,
      #chatShell.chat-slide-opening > .chat-thread,
      #chatShell.chat-slide-closing > .chat-sidebar,
      #chatShell.chat-slide-closing > .chat-thread { animation: none !important; }
    }
    /* Home KPI cards: compact WhatsApp-like rows with the metric anchored right. */
    .content > .grid.four > .kpi,
    .content > .grid.four > .kpi.kpi-link {
      min-height: 106px !important;
      display: grid !important;
      grid-template-columns: minmax(72px, 1fr) auto !important;
      grid-template-rows: auto minmax(42px, auto) auto !important;
      align-content: stretch !important;
      gap: 2px 12px !important;
      padding: 16px 18px !important;
      text-align: left !important;
      border-left-width: 4px !important;
    }
    .content > .grid.four > .kpi > .muted:first-child {
      grid-column: 1 !important;
      grid-row: 1 !important;
      align-self: end !important;
      font-size: 13px !important;
      line-height: 1.2 !important;
    }
    .content > .grid.four > .kpi > strong {
      grid-column: 2 !important;
      grid-row: 1 / span 2 !important;
      align-self: center !important;
      justify-self: end !important;
      font-size: clamp(30px, 4vw, 42px) !important;
      line-height: .95 !important;
      text-align: right !important;
    }
    .content > .grid.four > .kpi > .pill {
      grid-column: 1 / -1 !important;
      grid-row: 3 !important;
      width: 100% !important;
      min-height: 28px !important;
      justify-content: flex-start !important;
      padding-left: 12px !important;
      font-size: 12px !important;
    }
    @media (max-width: 720px) {
      .content > .grid.four { gap: 12px !important; }
      .content > .grid.four > .kpi,
      .content > .grid.four > .kpi.kpi-link {
        min-height: 112px !important;
        padding: 17px 16px !important;
      }
      .content > .grid.four > .kpi > strong { font-size: 38px !important; }
    }
    /* .grid.four lays out 2-per-row below 980px (see .grid.three, .grid.four
       rule), which halves each KPI card's width -- too narrow for the
       "anchored right" row layout above once the number needs more than a
       digit or two (e.g. "0.00 m" was wrapping into a vertical stack next
       to a squeezed label). Fall back to plain stacked label/number/pill,
       which is safe at any value length. */
    @media (max-width: 980px) {
      .content > .grid.four > .kpi,
      .content > .grid.four > .kpi.kpi-link {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: none !important;
        align-content: space-between !important;
        gap: 6px !important;
      }
      .content > .grid.four > .kpi > .muted:first-child {
        grid-column: 1 !important;
        grid-row: auto !important;
        align-self: start !important;
      }
      .content > .grid.four > .kpi > strong {
        grid-column: 1 !important;
        grid-row: auto !important;
        justify-self: start !important;
        text-align: left !important;
        font-size: 26px !important;
      }
      .content > .grid.four > .kpi > .pill {
        grid-column: 1 !important;
        grid-row: auto !important;
      }
    }
