  :root {
    --crm-locked-background: #f2f2f7;
    --crm-auth-overlay-background: rgba(242,243,247,.44);
    --crm-auth-card-background: rgba(255,255,255,.97);
    --crm-auth-card-border: rgba(27,30,38,.14);
    --crm-auth-card-color: #1b1d24;
    --crm-auth-card-shadow: 0 28px 80px rgba(35,39,51,.24);
    --crm-auth-muted: #686e7b;
    --crm-auth-label: #545a67;
    --crm-auth-field-background: #f7f8fa;
    --crm-auth-field-border: #cfd4de;
    --crm-auth-field-color: #17191f;
    --crm-auth-panel-background: #f4f6f8;
    --crm-auth-panel-border: #d7dce5;
    --crm-auth-accent-color: #217f73;
    --crm-auth-error-color: #c9372c;
    --crm-auth-info-color: #285d56;
    --crm-auth-recovery-color: #4e391b;
    --crm-auth-recovery-code: #845714;
    --crm-auth-empty-color: #777e8b;
    --crm-auth-secondary-color: #555b68;
    --crm-auth-secondary-hover: #1b1d24;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  [data-normalization-view][aria-hidden="true"] { display: none; }
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f2f2f7; color: #1a1a1a; }
  .crm { display: flex; min-height: 100vh; transition: filter .25s ease, opacity .25s ease, transform .25s ease; }
  body.crm-locked { overflow: hidden; background: var(--crm-locked-background); }
  body.crm-profile-editing { overflow: hidden; }
  body.crm-locked .crm,
  body.crm-profile-editing .crm { filter: blur(5px) saturate(.76); opacity: .76; transform: scale(1.008); pointer-events: none; user-select: none; }
  body.crm-entry-pending .crm { visibility: hidden; opacity: 0; }
  .crm-auth-overlay { position: fixed; z-index: 300; inset: 0; display: none; width: 100%; height: 100dvh; align-items: flex-start; justify-content: center; overflow-x: hidden; overflow-y: auto; padding: max(72px,9vh) 20px max(24px,env(safe-area-inset-bottom)); background: var(--crm-auth-overlay-background); backdrop-filter: blur(2px); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  body.crm-locked .crm-auth-overlay,
  body.crm-profile-editing .crm-auth-overlay { display: flex; }
  body.crm-auth-checking .crm-auth-overlay { display: none; }
  body.crm-entry-pending .crm-auth-overlay { display: none; }
  .crm-login-card,
  .crm-profile-card { padding: 28px; border: 1px solid var(--crm-auth-card-border); border-radius: 20px; background: var(--crm-auth-card-background); color: var(--crm-auth-card-color); box-shadow: var(--crm-auth-card-shadow); }
  .crm-login-card { width: min(470px,100%); }
  .crm-profile-card { position: relative; width: min(760px,100%); }
  .crm-profile-close { position: absolute; top: 16px; right: 16px; display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border: 1px solid var(--crm-auth-field-border); border-radius: 50%; background: transparent; color: var(--crm-auth-secondary-color); font: inherit; font-size: 23px; line-height: 1; cursor: pointer; }
  .crm-profile-close:hover { border-color: #55c4b5; color: var(--crm-auth-accent-color); }
  .crm-login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
  .crm-login-logo { width: 52px; height: 52px; border-radius: 50%; background: #f5f5f5; object-fit: contain; }
  .crm-login-brand-name { font-size: 16px; font-weight: 780; letter-spacing: .045em; }
  .crm-login-brand-sub { margin-top: 4px; color: var(--crm-auth-muted); font-size: 11px; }
  .crm-login-title { font-size: 25px; font-weight: 740; }
  .crm-login-copy { margin-top: 7px; color: var(--crm-auth-muted); font-size: 13px; line-height: 1.45; }
  .crm-profile-card.is-invite-registration { border-color: rgba(85,196,181,.46); box-shadow: var(--crm-auth-card-shadow), 0 0 0 1px rgba(85,196,181,.08); }
  .crm-profile-card.is-invite-registration .crm-login-brand { margin-bottom: 18px; }
  .crm-profile-card.is-invite-registration .crm-login-brand-sub { color: var(--crm-auth-accent-color); font-weight: 800; letter-spacing: .12em; }
  .crm-profile-card.is-invite-registration .crm-login-title { color: var(--crm-auth-accent-color); font-size: clamp(36px,4vw,46px); font-weight: 820; letter-spacing: -.035em; line-height: 1.04; }
  .crm-profile-card.is-invite-registration .crm-login-copy { margin-top: 14px; padding: 14px 16px; border-left: 4px solid #43b7a8; border-radius: 0 12px 12px 0; background: rgba(67,183,168,.12); color: var(--crm-auth-card-color); font-size: 16px; font-weight: 650; line-height: 1.5; }
  .crm-profile-card.is-invite-registration .crm-login-form { margin-top: 20px; }
  .crm-profile-card.is-invite-registration .crm-profile-user { border-color: rgba(85,196,181,.34); }
  .crm-profile-change-notice { margin-top: 14px; padding: 11px 13px; border: 1px solid rgba(85,196,181,.34); border-radius: 11px; background: rgba(67,183,168,.1); color: var(--crm-auth-info-color); font-size: 12px; font-weight: 650; line-height: 1.45; }
  .crm-profile-change-notice[hidden] { display: none; }
  .crm-profile-change-notice strong { color: var(--crm-auth-accent-color); }
  .crm-login-form { display: flex; flex-direction: column; gap: 13px; margin-top: 22px; }
  .crm-login-form[hidden] { display: none; }
  .crm-login-field { display: flex; flex-direction: column; gap: 7px; color: var(--crm-auth-label); font-size: 11px; font-weight: 700; }
  .crm-login-field input { width: 100%; padding: 13px 14px; border: 1px solid var(--crm-auth-field-border); border-radius: 11px; outline: none; background: var(--crm-auth-field-background); color: var(--crm-auth-field-color); font: inherit; font-size: 14px; }
  .crm-login-field input:focus { border-color: #55c4b5; box-shadow: 0 0 0 3px rgba(85,196,181,.14); }
  .crm-login-submit { min-height: 45px; margin-top: 3px; border: 0; border-radius: 11px; background: #43b7a8; color: #071411; font: inherit; font-size: 14px; font-weight: 780; cursor: pointer; }
  .crm-login-submit:hover { background: #55c4b5; }
  .crm-login-submit:disabled { cursor: wait; opacity: .65; }
  .crm-login-error { min-height: 18px; color: var(--crm-auth-error-color); font-size: 11px; line-height: 1.35; }
  .crm-mfa-setup { display: grid; gap: 8px; margin-top: 18px; padding: 13px; border: 1px solid rgba(85,196,181,.32); border-radius: 11px; background: rgba(67,183,168,.09); color: var(--crm-auth-label); font-size: 11px; }
  .crm-mfa-setup[hidden] { display: none; }
  .crm-mfa-setup code { overflow-wrap: anywhere; color: var(--crm-auth-accent-color); font-size: 15px; font-weight: 760; letter-spacing: .08em; }
  .crm-mfa-recovery { display: grid; gap: 12px; margin: 20px 0 14px; padding: 14px; border: 1px solid rgba(255,190,92,.34); border-radius: 11px; background: rgba(255,190,92,.09); color: var(--crm-auth-recovery-color); font-size: 12px; line-height: 1.45; }
  .crm-mfa-recovery[hidden] { display: none; }
  .crm-mfa-recovery code { white-space: pre-wrap; color: var(--crm-auth-recovery-code); font-size: 14px; font-weight: 760; letter-spacing: .04em; line-height: 1.7; }
  .crm-profile-card[hidden],
  .crm-login-card[hidden] { display: none; }
  .crm-profile-user { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--crm-auth-panel-border); border-radius: 13px; background: var(--crm-auth-panel-background); }
  .crm-profile-avatar-column { display: flex; width: 92px; flex: 0 0 auto; flex-direction: column; align-items: center; gap: 8px; }
  .crm-profile-avatar { display: flex; width: 72px; height: 72px; flex: 0 0 auto; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; background: rgba(67,183,168,.16); color: var(--crm-auth-accent-color); font-size: 17px; font-weight: 800; }
  .crm-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .crm-profile-avatar-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
  .crm-profile-avatar-actions button,
  .crm-profile-avatar-upload { padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--crm-auth-accent-color); font: inherit; font-size: 9px; font-weight: 700; cursor: pointer; }
  .crm-profile-avatar-actions button { color: var(--crm-auth-error-color); }
  .crm-profile-avatar-actions button:hover,
  .crm-profile-avatar-upload:hover { background: rgba(67,183,168,.1); }
  .crm-profile-avatar-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .crm-profile-identity-fields { display: grid; min-width: 0; flex: 1; grid-template-columns: 1fr 1fr; gap: 9px; }
  .crm-profile-identity-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--crm-auth-muted); font-size: 9px; font-weight: 700; }
  .crm-profile-identity-field:first-child { grid-column: 1/-1; }
  .crm-profile-identity-field input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--crm-auth-field-border); border-radius: 9px; outline: none; background: var(--crm-auth-field-background); color: var(--crm-auth-field-color); font: inherit; font-size: 12px; font-weight: 600; }
  .crm-profile-identity-field input:focus { border-color: #55c4b5; box-shadow: 0 0 0 3px rgba(85,196,181,.12); }
  .crm-profile-details { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
  .crm-profile-details select { width: 100%; padding: 13px 14px; border: 1px solid var(--crm-auth-field-border); border-radius: 11px; outline: none; background: var(--crm-auth-field-background); color: var(--crm-auth-field-color); font: inherit; font-size: 14px; }
  .crm-profile-details select:focus { border-color: #55c4b5; box-shadow: 0 0 0 3px rgba(85,196,181,.14); }
  .crm-profile-telegram { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 13px; border: 1px solid var(--crm-auth-panel-border); border-radius: 12px; background: var(--crm-auth-panel-background); }
  .crm-profile-telegram > div:first-child { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
  .crm-profile-telegram strong { color: var(--crm-auth-label); font-size: 12px; }
  .crm-profile-telegram span { color: var(--crm-auth-muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
  .crm-profile-telegram .crm-profile-telegram-help { max-width: 480px; }
  .crm-profile-telegram-help code { display: inline-block; max-width: 100%; color: var(--crm-auth-label); font-size: 10px; overflow-wrap: anywhere; user-select: all; }
  .crm-profile-telegram-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
  .crm-profile-telegram-actions button,
  .crm-profile-telegram-actions a { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; padding: 7px 10px; border: 1px solid #43b7a8; border-radius: 8px; background: transparent; color: var(--crm-auth-accent-color); font: inherit; font-size: 10px; font-weight: 750; text-decoration: none; cursor: pointer; }
  .crm-profile-telegram-actions .primary { background: #43b7a8; color: #071411; }
  .crm-profile-telegram-actions .danger { border-color: rgba(201,55,44,.42); color: var(--crm-auth-error-color); }
  [data-profile-self-only][hidden] { display: none !important; }
  .crm-profile-rights-label { margin-top: 4px; color: var(--crm-auth-label); font-size: 11px; font-weight: 700; }
  .crm-profile-rights { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
  .crm-profile-right { display: flex; min-height: 47px; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid rgba(67,183,168,.28); border-radius: 10px; background: rgba(67,183,168,.09); color: var(--crm-auth-info-color); font-size: 11px; font-weight: 650; line-height: 1.3; }
  .crm-profile-right::before { content: '✓'; display: inline-flex; width: 20px; height: 20px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 6px; background: #43b7a8; color: #071411; font-size: 12px; font-weight: 900; }
  .crm-profile-rights-empty { grid-column: 1/-1; padding: 12px; border: 1px dashed var(--crm-auth-field-border); border-radius: 10px; color: var(--crm-auth-empty-color); font-size: 11px; text-align: center; }
  .crm-profile-actions { display: grid; grid-template-columns: 1fr 1.45fr; gap: 9px; margin-top: 3px; }
  .crm-profile-back { min-height: 45px; border: 1px solid var(--crm-auth-field-border); border-radius: 11px; background: transparent; color: var(--crm-auth-secondary-color); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
  .crm-profile-back:hover { border-color: #555b68; color: var(--crm-auth-secondary-hover); }
  @media (min-width: 521px) and (max-height: 820px) {
    .crm-auth-overlay { padding: 16px 20px; }
    .crm-profile-card { padding: 20px 24px; }
    .crm-profile-card .crm-login-brand { margin-bottom: 14px; }
    .crm-profile-card .crm-login-logo { width: 44px; height: 44px; }
    .crm-profile-card .crm-login-title { font-size: 23px; }
    .crm-profile-card .crm-login-copy { margin-top: 5px; }
    .crm-profile-card.is-invite-registration .crm-login-title { font-size: 34px; }
    .crm-profile-card.is-invite-registration .crm-login-copy { margin-top: 9px; padding: 10px 13px; font-size: 13px; }
    .crm-profile-card .crm-profile-change-notice { margin-top: 10px; padding: 8px 11px; }
    .crm-profile-card .crm-login-form { gap: 9px; margin-top: 14px; }
    .crm-profile-card .crm-profile-user { padding: 10px; }
    .crm-profile-card .crm-login-field input { padding: 10px 12px; }
    .crm-profile-card .crm-profile-rights { gap: 6px; margin-top: 6px; }
    .crm-profile-card .crm-profile-right { min-height: 40px; padding: 7px 9px; }
    .crm-profile-card .crm-profile-actions { margin-top: 0; }
  }
  @media (max-width: 520px) {
    .crm-auth-overlay {
      height: 100%;
      max-height: 100dvh;
      justify-content: flex-start;
      overflow-y: scroll;
      scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom));
      padding: max(12px,env(safe-area-inset-top)) 10px calc(96px + env(safe-area-inset-bottom));
    }
    .crm-login-card,
    .crm-profile-card { width: 100%; flex: 0 0 auto; margin: 0 auto; padding: 18px 16px; border-radius: 16px; }
    .crm-login-brand { gap: 10px; margin-bottom: 17px; }
    .crm-login-logo { width: 44px; height: 44px; }
    .crm-login-brand-name { font-size: clamp(13px,4vw,16px); letter-spacing: .025em; }
    .crm-login-brand-sub { font-size: 10px; }
    .crm-login-title { font-size: clamp(22px,7vw,28px); line-height: 1.08; }
    .crm-login-copy { font-size: 12px; }
    .crm-profile-card.is-invite-registration .crm-login-title { font-size: clamp(30px,9vw,38px); }
    .crm-profile-card.is-invite-registration .crm-login-copy { padding: 12px 13px; font-size: 14px; }
    .crm-login-form { gap: 11px; margin-top: 17px; }
    .crm-profile-user { align-items: center; }
    .crm-profile-identity-fields { grid-template-columns: 1fr; }
    .crm-profile-identity-field:first-child { grid-column: auto; }
    .crm-profile-details { grid-template-columns: 1fr; gap: 11px; }
    .crm-profile-rights { grid-template-columns: 1fr; }
    .crm-invite-overlay { align-items: flex-end; padding: 8px; }
    .crm-invite-dialog { max-height: calc(100dvh - 16px); padding: 18px 16px max(18px,env(safe-area-inset-bottom)); border-radius: 16px; }
    .crm-invite-permissions { grid-template-columns: 1fr; }
    .crm-invite-sensitive-permissions { grid-template-columns: 1fr; }
    .crm-invite-result-row { flex-direction: column; }
    .crm-invite-copy { min-height: 40px; }
    .crm-invite-history-accepted { grid-template-columns: 1fr; }
    .crm-invite-history-profile { grid-column: 1; grid-row: auto; }
    .crm-profile-actions {
      position: static;
      z-index: auto;
      bottom: auto;
      grid-template-columns: .85fr 1.45fr;
      margin: 4px 0 0;
      padding: 0 0 max(12px,env(safe-area-inset-bottom));
      background: none;
    }
    .crm-profile-actions .crm-login-submit,
    .crm-profile-actions .crm-profile-back { min-height: 52px; }
  }
