    :root {
      --bg: #fdfdfd;
      --bg-elevated: #f5f5f5;
      --label: #171717;
      --label-secondary: #707070;
      --label-tertiary: #8e8e8e;
      --label-quaternary: #c4c4c4;
      --separator: #e1e1e1;
      --separator-strong: #c6c6c8;
      --separator-soft: #e9e9e9;
      --section-label: #7a7974;
      --chevron: #888781;
      --outline: #f5f5f5;
      --on-tint: #171717;
      --tint: #61d379;
      --tint-text: #59c471;
      --tint-pressed: #4fc067;
      --destructive: #ff3b30;
      --success: #34c759;
      --avatar-bg: #e1e1e1;
      --nav-h: 60px;
      --tab-h: 64px;
    }

    @font-face {
      font-family: 'Fraunces';
      src: url('/fonts/fraunces.woff2') format('woff2-variations'),
           url('/fonts/fraunces.woff2') format('woff2');
      font-weight: 100 900;
      font-style: normal;
      font-display: swap;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    html { -webkit-text-size-adjust: 100%; }

    body {
      background: var(--bg);
      color: var(--label);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      font-size: 17px;
      line-height: 1.3;
      min-height: 100vh;
      min-height: 100dvh;
      -webkit-font-smoothing: antialiased;
      -webkit-tap-highlight-color: transparent;
    }

    button { font: inherit; cursor: pointer; color: inherit; }
    input, select, textarea, button { font-family: inherit; }
    a { color: var(--tint-text); text-decoration: none; }

    #auth-screen,
    #app { display: none; }
    #auth-screen.ready { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
    #app.ready {
      display: block;
      min-height: 100vh;
      min-height: 100dvh;
      padding-top: env(safe-area-inset-top);
      padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
    }

    /* ───────── NAV BAR ───────── */
    .nav-row {
      position: sticky;
      top: 0;
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: var(--nav-h);
      padding: 0 12px 0 16px;
      background: rgba(253, 253, 253, 0.92);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
    }
    .nav-row .nav-action,
    .nav-row .nav-side {
      min-width: 40px;
      display: flex;
      align-items: center;
    }
    .nav-row .nav-action { justify-content: flex-end; }
    .nav-row > :first-child { justify-content: flex-start; }
    .nav-title { display: none; }
    .nav-btn {
      background: none;
      border: none;
      color: var(--label);
      font-size: 17px;
      padding: 6px 8px;
      display: inline-flex;
      align-items: center;
      gap: 2px;
    }
    .nav-btn:active { opacity: 0.5; }
    .nav-btn:disabled { color: var(--label-quaternary); }
    .nav-btn.plus { padding: 6px; }
    .nav-btn-strong { font-weight: 600; }
    .nav-btn-fab {
      width: 48px;
      height: 48px;
      background: var(--tint);
      color: var(--on-tint);
      border: 0;
      border-radius: 50%;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.12s, background 0.12s;
      cursor: pointer;
    }
    .nav-btn-fab:active {
      background: var(--tint-pressed);
      transform: scale(0.94);
    }
    .nav-btn-fab svg { width: 26px; height: 26px; }

    /* Large title (scrolls away) */
    .large-title {
      padding: 6px 24px 16px;
      font-size: 34px;
      font-weight: 700;
      letter-spacing: -0.5px;
      line-height: 1.1;
      text-wrap: balance;
    }

    /* ───────── SEARCH ───────── */
    .search-wrap { padding: 8px 24px 12px; }
    .search-input {
      width: 100%;
      padding: 12px 16px 12px 44px;
      background: var(--bg-elevated);
      border: none;
      box-shadow: inset 0 0 0 1px var(--outline);
      border-radius: 9999px;
      font-size: 17px;
      color: var(--label);
      outline: none;
      -webkit-appearance: none;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3-3'/></svg>");
      background-repeat: no-repeat;
      background-position: 18px center;
    }
    .search-input::placeholder { color: var(--label-tertiary); }

    /* ───────── SHEET LAYOUT (view-contacts) ─────────
       Chrome bg stays on var(--bg) and curves inward (bottom-rounded
       on top chrome, top-rounded on the tab bar). The list sits
       directly on the page background with hairlines only: the
       search field is the only grey surface on this page. */
    #view-contacts .top-chrome {
      background: var(--bg);
      border-bottom-left-radius: 20px;
      border-bottom-right-radius: 20px;
      padding-bottom: 4px;
    }
    #view-contacts .nav-row {
      position: static;
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
    #view-contacts .sheet {
      background: var(--bg);
      margin: 10px 4px 0;
      overflow: hidden;
    }
    #view-contacts .sheet .list-header {
      position: static;
      padding: 14px 20px 4px;
      background: var(--bg);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
    #view-contacts .sheet .list-card {
      margin: 0;
      padding: 10px 20px;
      border-radius: 0;
      box-shadow: none;
      background: transparent;
      width: 100%;
      border-bottom: 0.5px solid var(--separator);
    }
    #view-contacts .sheet .list-card:last-child {
      border-bottom: none;
    }
    #view-contacts .sheet .list-card:active {
      transform: none;
      background: rgba(0, 0, 0, 0.04);
    }

    /* ───────── HERO ILLUSTRATION ───────── */
    .hero-illustration {
      padding: 6px 16px 18px;
      text-align: center;
    }
    .hero-illustration svg,
    .hero-illustration img {
      width: 100%;
      max-width: 280px;
      height: auto;
      display: inline-block;
    }

    /* ───────── LIST ───────── */
    .list-header {
      position: sticky;
      top: var(--nav-h);
      z-index: 5;
      padding: 18px 24px 6px;
      background: rgba(253, 253, 253, 0.92);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      font-size: 13px;
      font-weight: 600;
      color: var(--label-tertiary);
      letter-spacing: 0.02em;
    }
    .list-card {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 18px;
      margin: 8px 16px;
      background: var(--bg-elevated);
      border: none;
      border-radius: 20px;
      width: calc(100% - 32px);
      text-align: left;
      box-shadow: 0 0 0 1px var(--outline);
      transition: transform 0.1s, background 0.1s;
      cursor: pointer;
    }
    .list-card:active {
      transform: scale(0.985);
      background: rgba(255, 255, 255, 0.7);
    }
    .list-card-text {
      flex: 1;
      min-width: 0;
    }
    .list-card-name {
      font-size: 18px;
      font-weight: 600;
      letter-spacing: -0.2px;
      color: var(--label);
      line-height: 1.3;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .chevron {
      color: var(--label-quaternary);
      font-size: 18px;
      line-height: 1;
      margin-left: 4px;
    }

    /* Special "My Card" row at top of list */
    .me-row {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 16px;
      margin: 6px 16px 20px;
      background: var(--bg-elevated);
      border-radius: 16px;
      box-shadow: 0 0 0 1px var(--outline);
      cursor: pointer;
      transition: transform 0.1s;
    }
    .me-row:active { transform: scale(0.985); }
    .me-row .me-text { flex: 1; min-width: 0; }
    .me-row .me-name { font-size: 17px; font-weight: 600; }
    .me-row .me-sub { font-size: 13px; color: var(--tint-text); margin-top: 2px; }

    /* ───────── AVATAR ───────── */
    .avatar {
      position: relative;
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: var(--avatar-bg);
      color: var(--on-tint);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      font-weight: 500;
      flex-shrink: 0;
      letter-spacing: -0.3px;
      overflow: hidden;
    }
    .avatar-lg {
      position: relative;
      width: 100px;
      height: 100px;
      border-radius: 50%;
      background: var(--avatar-bg);
      color: var(--on-tint);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 38px;
      font-weight: 500;
      letter-spacing: -1px;
      margin-bottom: 10px;
      overflow: hidden;
    }
    .avatar-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .avatar-upload {
      display: inline-block;
      position: relative;
      cursor: pointer;
    }
    .avatar-upload-link {
      display: block;
      margin: 0 auto 12px;
      font-size: 14px;
      color: var(--tint-text);
      background: none;
      border: none;
      padding: 6px 12px;
      font-weight: 500;
    }
    .avatar-upload-link:disabled { opacity: 0.5; }

    /* Hero della propria scheda: avatar e QR della stessa misura, centrati in coppia.
       Padding tight + margin-bottom 10px = stessa posizione verticale di avatar
       e testi delle altre schede contatto (dove .avatar-lg ha margin-bottom 10). */
    .hero-twins {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 16px;
      margin-bottom: 10px;
    }
    .hero-twins .avatar-lg { margin-bottom: 0; }
    .qr-thumb {
      flex: 0 0 auto;
      width: 100px;
      height: 100px;
      border-radius: 50%;
      background: var(--tint);
      color: var(--on-tint);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.12s;
      border: none;
      padding: 0;
    }
    .qr-thumb:active { transform: scale(0.94); }
    .qr-thumb svg {
      width: 44%;
      height: 44%;
      display: block;
    }

    /* QR modal */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 200;
      display: none;
      align-items: center;
      justify-content: center;
      padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
    }
    .modal-backdrop.show { display: flex; }
    .modal-card {
      background: var(--bg-elevated);
      border-radius: 22px;
      padding: 28px 24px 22px;
      max-width: 360px;
      width: 100%;
      text-align: center;
      position: relative;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    }
    .modal-close {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 32px;
      height: 32px;
      border: none;
      border-radius: 50%;
      background: rgba(118, 118, 128, 0.16);
      color: var(--label-secondary);
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }
    .modal-card .qr-big-wrap {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 14px;
      background: white;
      border-radius: 14px;
      margin: 6px 0 16px;
    }
    .modal-card .qr-big-wrap > div { width: 240px; height: 240px; }
    .modal-card .qr-big-wrap img, .modal-card .qr-big-wrap canvas {
      width: 100% !important;
      height: 100% !important;
      display: block;
    }
    .modal-card h3 { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
    .modal-card p { font-size: 14px; color: var(--label-secondary); line-height: 1.4; margin-bottom: 16px; }
    .modal-card .modal-actions-stack {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .modal-card .modal-actions-stack button {
      width: 100%;
      padding: 13px;
      font-size: 15px;
      border-radius: 12px;
    }
    /* Crop avatar modal */
    .crop-modal-card { max-width: 420px; }
    .crop-stage {
      width: 100%;
      aspect-ratio: 1;
      background: #000;
      border-radius: 14px;
      overflow: hidden;
      margin: 0 0 16px;
      position: relative;
    }
    .crop-stage img {
      display: block;
      max-width: 100%;
      max-height: 100%;
    }
    /* Make Cropper's crop box appear circular even though the underlying
       crop is square; the actual exported canvas is square 480x480. */
    .cropper-view-box,
    .cropper-face { border-radius: 50%; outline: 0; }
    .cropper-line, .cropper-point { display: none !important; }
    .btn-cancel {
      width: 100%;
      padding: 13px;
      font-size: 15px;
      border-radius: 12px;
      background: none;
      border: 0;
      color: var(--label-secondary);
      cursor: pointer;
    }
    .btn-cancel:active { background: rgba(0, 0, 0, 0.05); }

    .btn-telegram { background: #0088cc; }
    .btn-telegram:active { background: #006699; }

    /* Aggiungi chooser page */
    .chooser-section { padding: 0 16px 20px; }
    .chooser-intro {
      font-size: 17px;
      color: var(--label-secondary);
      line-height: 1.45;
      margin-bottom: 22px;
    }
    .chooser-primary {
      display: block;
      width: 100%;
      padding: 22px 16px;
      background: var(--tint);
      color: var(--on-tint);
      border: none;
      border-radius: 18px;
      font-size: 17px;
      font-weight: 600;
      margin-bottom: 18px;
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }
    .chooser-primary:active { background: var(--tint-pressed); transform: scale(0.985); }
    .chooser-primary svg { width: 24px; height: 24px; }
    .chooser-secondary {
      display: block;
      width: 100%;
      padding: 16px;
      background: transparent;
      color: var(--tint-text);
      border: 1.5px solid var(--tint);
      border-radius: 18px;
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 18px;
      cursor: pointer;
      transition: background 0.1s, transform 0.1s;
    }
    .chooser-secondary:active { background: rgba(0, 0, 0, 0.05); transform: scale(0.985); }
    .chooser-toggle {
      width: 100%;
      background: none;
      border: none;
      color: var(--label-tertiary);
      font-size: 14px;
      padding: 6px;
      text-align: center;
      cursor: pointer;
    }
    .chooser-paste { display: none; margin-top: 12px; }
    .chooser-paste.show { display: block; }
    .chooser-illustration {
      margin-top: 40px;
      text-align: center;
      padding: 16px;
    }
    .chooser-illustration img {
      width: 100%;
      max-width: 260px;
      height: auto;
      display: inline-block;
      opacity: 0.85;
    }

    /* Scanner view */
    .scanner-body {
      padding: 16px;
      text-align: center;
    }
    .scanner-frame {
      position: relative;
      width: 100%;
      max-width: 360px;
      margin: 0 auto 16px;
      aspect-ratio: 1 / 1;
      background: #000;
      border-radius: 18px;
      overflow: hidden;
    }
    .scanner-frame video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .scanner-hint {
      font-size: 14px;
      color: var(--label-tertiary);
      line-height: 1.5;
      max-width: 320px;
      margin: 0 auto;
    }

    /* ───────── DETAIL ───────── */
    .detail-hero {
      text-align: center;
      padding: 16px 16px 28px;
    }
    .detail-name {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -0.4px;
      line-height: 1.15;
    }
    .detail-subname {
      font-family: 'Fraunces', serif;
      font-size: 18px;
      color: var(--label);
      margin-top: 6px;
      line-height: 1.2;
    }
    .detail-mestiere {
      font-size: 18px;
      color: var(--label-secondary);
      margin-top: 6px;
      line-height: 1.2;
    }
    .detail-meta {
      font-size: 13px;
      color: var(--label-tertiary);
      margin-top: 8px;
      line-height: 1.35;
    }
    .detail-footnote {
      font-size: 12px;
      color: var(--label-tertiary);
      text-align: center;
      padding: 18px 16px 4px;
      line-height: 1.35;
    }
    .detail-compleanno {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-top: 6px;
      font-size: 18px;
      color: var(--label-tertiary);
      line-height: 1.2;
    }
    .detail-compleanno svg {
      width: 16px;
      height: 16px;
    }

    .compleanno-row {
      display: flex;
      gap: 6px;
      flex: 1;
      min-width: 0;
    }
    .compleanno-row select {
      flex: 1;
      min-width: 0;
      padding: 6px 18px 6px 8px;
      background: rgba(118, 118, 128, 0.12);
      border: none;
      border-radius: 6px;
      font-size: 15px;
      color: var(--label);
      outline: none;
      -webkit-appearance: none;
      appearance: none;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5' fill='none'><path d='M1 1l3 3 3-3' stroke='%238e8e93' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
      background-repeat: no-repeat;
      background-position: right 6px center;
      cursor: pointer;
    }

    /* ───────── GROUPED FORM / FIELDS ───────── */
    /* Etichette di sezione: maiuscola solo all'iniziale, grigio caldo,
       rientrate di 20px rispetto al bordo della card. */
    .group-label {
      padding: 24px 36px 8px;
      font-size: 17px;
      color: var(--section-label);
      line-height: 1.3;
    }
    .group-label:first-child { padding-top: 6px; }
    .group {
      background: var(--bg-elevated);
      border-radius: 26px;
      margin: 0 16px 14px;
      box-shadow: 0 0 0 1px var(--outline);
      overflow: hidden;
    }
    .group-row {
      display: flex;
      flex-direction: column;
      padding: 12px 46px 12px 18px;
      border-top: 0.5px solid var(--separator);
      min-height: 60px;
      justify-content: center;
      position: relative;
    }
    .group-row:first-child { border-top: 0; }
    .group-row-tap {
      transition: background 0.1s;
      color: var(--label);
    }
    .group-row-tap:active { background: rgba(0, 0, 0, 0.05); }
    .row-label {
      font-size: 14px;
      color: var(--label-tertiary);
      margin-bottom: 3px;
      line-height: 1.35;
    }
    .row-value {
      font-size: 18px;
      line-height: 1.35;
    }
    .row-value.tint { color: var(--tint-text); }
    .row-sub-value {
      font-size: 14px;
      color: var(--label-tertiary);
      margin-top: 2px;
      line-height: 1.35;
    }
    .row-icon {
      position: absolute;
      right: 18px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--label-tertiary);
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .row-icon svg { width: 18px; height: 18px; }
    .row-leading-icon {
      flex: 0 0 auto;
      width: 24px;
      height: 24px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: var(--label);
      margin-right: 10px;
    }
    .row-leading-icon svg { width: 22px; height: 22px; stroke-width: 1.6; }

    /* Settings rows: label left, optional value/checkmark right, chevron */
    .group-row-settings {
      flex-direction: row;
      align-items: center;
      gap: 8px;
      padding: 14px 27px 14px 16px;
      min-height: 52px;
      width: 100%;
      background: none;
      border: 0;
      position: relative;
      text-align: left;
      cursor: pointer;
      font: inherit;
      color: inherit;
      text-decoration: none;
    }
    /* Separatore che parte sotto il testo, non sotto l'icona */
    .group-row-settings::before {
      content: '';
      position: absolute;
      top: 0;
      left: 16px;
      right: 0;
      border-top: 0.5px solid var(--separator);
    }
    .group-row-settings:has(.row-leading-icon)::before { left: 58px; }
    .group > .group-row-settings:first-child::before { display: none; }
    .group-row-settings .row-label {
      flex: 1;
      min-width: 0;
      margin: 0;
      font-size: 17px;
      color: var(--label);
    }
    .row-value-end {
      flex: 0 0 auto;
      white-space: nowrap;
      padding-left: 8px;
      font-size: 17px;
      color: var(--label-secondary);
      margin-left: auto;
    }
    .settings-chevron {
      flex: 0 0 auto;
      display: inline-flex;
      color: var(--chevron);
      margin-left: 16px;
    }
    /* Riga "Esci": come le altre voci, ma in rosso e senza chevron */
    .group-logout { margin-top: 24px; margin-bottom: 24px; }
    .group-row-destructive .row-leading-icon,
    .group-row-destructive .row-label { color: var(--destructive); }
    .settings-checkmark {
      color: var(--tint-text);
      font-size: 18px;
      font-weight: 600;
      margin-left: auto;
    }

    /* Crediti page */
    #view-impostazioni-crediti .large-title { padding-bottom: 8px; }
    .crediti-content {
      padding: 0 24px 40px;
      color: var(--label);
    }
    .crediti-tagline {
      font-size: 32px;
      line-height: 1.2;
      color: var(--label-secondary);
      margin-top: 0;
      text-wrap: balance;
    }
    .crediti-illustration {
      margin-top: 24px;
    }
    .crediti-illustration img {
      max-width: 320px;
      width: 100%;
      height: auto;
      display: block;
    }
    .crediti-blurb {
      margin-top: 32px;
      font-size: 19px;
      line-height: 1.5;
      color: var(--label-tertiary);
    }
    .crediti-blurb a {
      color: var(--tint-text);
      text-decoration: none;
    }
    .crediti-version {
      margin-top: 16px;
      font-size: 13px;
      color: var(--label-quaternary);
      font-variant-numeric: tabular-nums;
    }

    /* Pagine descrittive (Installa come app, Cambia password): tagline, testo, azione, illustrazione */
    .page-content {
      padding: 0 24px 32px;
      color: var(--label);
    }
    .page-tagline {
      font-size: 22px;
      line-height: 1.3;
      color: var(--label-secondary);
      margin: 0 0 16px;
      text-wrap: balance;
    }
    /* Su Cambia password l'illustrazione va centrata e un filo più grande */
    #view-impostazioni-password .page-illustration img {
      max-width: 360px;
      margin: 0 auto;
    }
    .page-text {
      font-size: 19px;
      line-height: 1.5;
      color: var(--label-secondary);
      margin-bottom: 16px;
    }
    .page-text:last-child { margin-bottom: 0; }
    .page-action {
      margin-top: 16px;
    }
    .page-illustration {
      margin-top: 32px;
    }
    .page-illustration img {
      max-width: 280px;
      width: 100%;
      height: auto;
      display: block;
    }
    .install-icon {
      width: 18px;
      height: 18px;
      vertical-align: -4px;
      margin: 0 2px;
      color: var(--tint-text);
    }

    .group-row-inline {
      flex-direction: row;
      align-items: center;
      gap: 12px;
      padding-right: 16px;
    }
    .group-row-inline label {
      width: 100px;
      flex-shrink: 0;
      font-size: 17px;
      color: var(--label);
    }
    .group-row-inline input {
      flex: 1;
      min-width: 0;
      border: none;
      background: none;
      font-size: 17px;
      color: var(--label);
      outline: none;
      padding: 0;
      -webkit-appearance: none;
    }
    .group-row-inline input::placeholder { color: var(--label-tertiary); }

    /* ───────── MODULO DI MODIFICA (stile Contatti iPhone) ─────────
       Una riga per campo:  ⊖  etichetta ›  │  valore
       Separatori che partono dopo il pallino rosso. */
    .group-edit { margin-top: 16px; }
    .group-edit .group-row-inline { padding-left: 16px; }
    .edit-field {
      position: relative;
      display: flex;
      align-items: stretch;
      min-height: 52px;
      padding-left: 21px;
    }
    .edit-field::before,
    .group-edit .add-row::before {
      content: '';
      position: absolute;
      top: 0;
      left: 62px;
      right: 0;
      border-top: 0.5px solid var(--separator);
    }
    .group-edit > :first-child::before { display: none; }
    .edit-field .remove {
      align-self: center;
      position: relative;
      width: 24px;
      height: 24px;
      margin-right: 18px;
      border-radius: 50%;
      background: var(--destructive);
      border: none;
      padding: 0;
      flex-shrink: 0;
    }
    .edit-field .remove::after {
      content: '';
      position: absolute;
      left: 6.5px;
      right: 6.5px;
      top: 50%;
      height: 2px;
      margin-top: -1px;
      border-radius: 1px;
      background: white;
    }
    /* Colonna etichetta, allineata a destra con chevron */
    /* Colonna etichetta a larghezza fissa in tutti i gruppi: le etichette
       lunghe si troncano, così linee e distanze restano sempre allineate. */
    .edit-field .ef-label {
      flex: 0 0 90px;
      width: 90px;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 9px;
      padding: 0 10px 0 0;
      background: none;
      border: none;
      color: var(--tint-text);
      font-size: 17px;
      text-align: right;
      cursor: pointer;
      min-width: 0;
    }
    .edit-field .ef-label svg { flex: 0 0 auto; color: var(--chevron); }
    .edit-field .ef-label.is-empty { color: var(--label-tertiary); }
    .edit-field .ef-label-static { color: var(--label-secondary); cursor: default; }
    .edit-field .ef-label-text {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .edit-field button.ef-label:active { opacity: 0.5; }
    /* Colonna valore, con linea verticale sottile a sinistra */
    .edit-field .ef-value-col {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      border-left: 0.5px solid var(--separator-soft);
      padding-left: 17px;
    }
    .edit-field .ef-value-col:has(.address-fields),
    .edit-field .ef-value-col:has(.ef-stack) { padding-right: 20px; }
    .edit-field .ef-value {
      width: 100%;
      min-width: 0;
      border: none;
      background: none;
      font-size: 17px;
      color: var(--label);
      outline: none;
      padding: 14px 20px 14px 0;
      -webkit-appearance: none;
    }
    .ef-stack .ef-value { padding-right: 0; }
    .edit-field .ef-value::placeholder { color: var(--label-tertiary); }
    /* Più campi impilati a destra (indirizzo, azienda + ruolo) */
    .ef-stack,
    .address-fields {
      width: 100%;
      display: flex;
      flex-direction: column;
    }
    .ef-stack > * + *,
    .address-fields > * + * { border-top: 0.5px solid var(--separator); }
    .address-fields input,
    .address-fields select {
      width: 100%;
      min-width: 0;
      border: none;
      background: none;
      outline: none;
      color: var(--label);
      font-size: 17px;
      font-family: inherit;
      height: 48px;
      padding: 0;
      -webkit-appearance: none;
      appearance: none;
    }
    .address-fields input::placeholder { color: var(--label-tertiary); }
    .address-fields .addr-row { display: flex; }
    .address-fields .addr-row > * + * {
      border-left: 0.5px solid var(--separator-soft);
      padding-left: 10px;
    }
    .address-fields .addr-row .small { flex: 0 0 75px; width: 75px; }
    .addr-pick {
      position: relative;
      display: flex;
      align-items: center;
      height: 48px;
      min-width: 0;
      font-size: 17px;
      color: var(--label);
      cursor: pointer;
    }
    .addr-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .addr-pick.is-empty span { color: var(--label-tertiary); }
    .address-fields .addr-pick select {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      opacity: 0;
      cursor: pointer;
    }
    .addr-pick.addr-province { flex: 0 0 75px; width: 75px; }
    .addr-pick.addr-country { flex: 1; }

    /* "⊕ aggiungi telefono" */
    .add-row {
      position: relative;
      width: 100%;
      min-height: 52px;
      padding: 0 21px;
      background: none;
      border: none;
      color: var(--label);
      font-size: 17px;
      text-align: left;
      display: flex;
      align-items: center;
      gap: 18px;
    }
    .add-row:active { background: rgba(0, 0, 0, 0.04); }
    .add-row::after {
      content: '+';
      order: -1;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: var(--tint);
      color: white;
      font-size: 22px;
      font-weight: 500;
      line-height: 24px;
      text-align: center;
      flex-shrink: 0;
    }

    /* ───────── FOGLIO ETICHETTA (a tutto schermo) ───────── */
    body.sheet-open { overflow: hidden; }
    .label-sheet {
      position: fixed;
      inset: 0;
      z-index: 2000;
      background: var(--bg);
      display: flex;
      flex-direction: column;
      padding-top: env(safe-area-inset-top);
      transform: translateY(100%);
      transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
    }
    .label-sheet.open { transform: none; }
    .label-sheet-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
    }
    .sheet-close,
    .sheet-close-spacer { width: 44px; height: 44px; flex: 0 0 44px; }
    .sheet-close {
      border-radius: 50%;
      border: 0.5px solid var(--separator);
      background: var(--bg-elevated);
      color: var(--label);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }
    .sheet-close svg { width: 22px; height: 22px; }
    .label-sheet-title { font-size: 17px; font-weight: 600; }
    .label-sheet-body {
      flex: 1;
      overflow-y: auto;
      padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
    }
    .label-sheet-body .group { margin-bottom: 24px; }
    .sheet-option {
      position: relative;
      width: 100%;
      min-height: 52px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 18px;
      background: none;
      border: none;
      color: var(--label);
      font-size: 17px;
      text-align: left;
    }
    .sheet-option + .sheet-option::before {
      content: '';
      position: absolute;
      top: 0;
      left: 18px;
      right: 18px;
      border-top: 0.5px solid var(--separator);
    }
    .sheet-option:active { background: rgba(0, 0, 0, 0.04); }
    .sheet-check { color: var(--tint-text); font-size: 20px; font-weight: 500; }
    .sheet-custom {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 0 18px;
      min-height: 52px;
    }
    .sheet-custom input {
      flex: 1;
      min-width: 0;
      border: none;
      background: none;
      outline: none;
      font-size: 17px;
      color: var(--label);
    }
    .sheet-custom-ok {
      background: none;
      border: none;
      color: var(--tint-text);
      font-size: 17px;
      font-weight: 600;
    }

    /* Private note textarea in contact detail */
    .note-textarea {
      width: 100%;
      padding: 12px 14px;
      background: none;
      border: none;
      outline: none;
      font-family: inherit;
      font-size: 15px;
      color: var(--label);
      resize: none;
      min-height: 88px;
      line-height: 1.4;
      display: block;
      -webkit-appearance: none;
    }
    .note-textarea::placeholder { color: var(--label-tertiary); }
    .note-saving {
      font-size: 12px;
      color: var(--label-tertiary);
      padding: 0 14px 8px;
      opacity: 0;
      transition: opacity 0.2s;
    }
    .note-saving.show { opacity: 1; }

    /* Destructive button as floating card */
    .destructive-card {
      background: var(--bg-elevated);
      border-radius: 26px;
      margin: 6px 16px 24px;
      box-shadow: 0 0 0 1px var(--outline);
      overflow: hidden;
    }
    .destructive-btn {
      width: 100%;
      padding: 14px 16px;
      background: none;
      border: none;
      color: var(--destructive);
      font-size: 17px;
      text-align: center;
    }
    .destructive-btn:active { background: rgba(0, 0, 0, 0.05); }

    /* Display font: Fraunces 700 for h1-like titles */
    .large-title,
    .detail-name,
    .auth-title,
    .invite-confirm .ic-name {
      font-family: 'Fraunces', 'New York', Georgia, serif;
      font-weight: 700;
    }

    /* ───────── BUTTONS ───────── */
    .btn-primary {
      width: 100%;
      padding: 14px;
      background: var(--tint);
      color: var(--on-tint);
      border: none;
      border-radius: 12px;
      font-size: 17px;
      font-weight: 600;
    }
    .btn-primary:active { background: var(--tint-pressed); }
    .btn-primary:disabled { opacity: 0.5; }
    .btn-whatsapp { background: #25d366; }
    .btn-whatsapp:active { background: #1ebe5b; }

    /* ───────── QR ───────── */
    .qr-card {
      background: var(--bg-elevated);
      border-radius: 16px;
      padding: 20px;
      text-align: center;
      margin-bottom: 16px;
      box-shadow: 0 0 0 1px var(--outline);
    }
    .qr-card .qr-img-wrap {
      display: inline-block;
      padding: 10px;
      background: white;
      border-radius: 12px;
    }
    .qr-card img, .qr-card canvas {
      display: block;
      width: 220px;
      height: 220px;
      max-width: 100%;
    }
    .qr-card .qr-caption {
      margin-top: 12px;
      font-size: 13px;
      color: var(--label-tertiary);
      line-height: 1.4;
    }

    /* ───────── INVITE CONFIRM ───────── */
    .invite-confirm {
      padding: 40px 24px 32px;
      max-width: 420px;
      margin: 0 auto;
      text-align: center;
    }
    .invite-confirm .ic-eyebrow {
      font-size: 13px;
      color: var(--label-tertiary);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin-bottom: 18px;
    }
    .invite-confirm .ic-name {
      font-size: 26px;
      font-weight: 700;
      letter-spacing: -0.4px;
      margin-top: 14px;
    }
    .invite-confirm .ic-question {
      margin-top: 16px;
      font-size: 16px;
      color: var(--label-secondary);
      line-height: 1.5;
    }
    .invite-confirm .ic-question b { color: var(--label); }
    .invite-confirm .ic-fields {
      margin: 22px 0 28px;
      background: var(--bg-elevated);
      border-radius: 26px;
      padding: 0;
      text-align: left;
      box-shadow: 0 0 0 1px var(--outline);
      overflow: hidden;
    }
    .invite-confirm .ic-field {
      display: flex;
      flex-direction: column;
      padding: 10px 16px;
      border-top: 0.5px solid var(--separator);
    }
    .invite-confirm .ic-field:first-child { border-top: 0; }
    .invite-confirm .ic-actions {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 20px;
    }
    .invite-confirm .ic-cancel {
      background: none;
      border: none;
      color: var(--tint-text);
      font-size: 17px;
      padding: 12px;
    }

    /* ───────── SHARE ───────── */
    .share-section { padding: 0 16px; }
    .share-card {
      background: var(--bg-elevated);
      border-radius: 26px;
      padding: 16px;
      margin-bottom: 20px;
      box-shadow: 0 0 0 1px var(--outline);
    }
    .share-link {
      font-size: 13px;
      color: var(--label-secondary);
      word-break: break-all;
      padding: 10px 12px;
      background: var(--bg);
      border: 1px solid var(--outline);
      border-radius: 8px;
      margin-bottom: 12px;
      line-height: 1.4;
    }
    .share-actions { display: flex; gap: 8px; }
    .share-actions .btn-primary { padding: 11px; font-size: 15px; border-radius: 10px; }

    .accept-input {
      width: 100%;
      padding: 11px 12px;
      background: var(--bg);
      border: 0.5px solid var(--separator-strong);
      border-radius: 10px;
      font-size: 15px;
      outline: none;
      margin-bottom: 10px;
      -webkit-appearance: none;
    }
    .accept-input:focus { border-color: var(--tint); }
    .section-hint {
      font-size: 13px;
      color: var(--label-tertiary);
      line-height: 1.4;
      margin-bottom: 12px;
    }

    /* ───────── TAB BAR ───────── */
    .tab-bar {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      display: flex;
      align-items: center;
      justify-content: space-around;
      background: var(--bg);
      border-top: 1px solid var(--outline);
      padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
      z-index: 60;
    }
    .tab-btn {
      flex: 1;
      background: none;
      border: none;
      padding: 8px 0 4px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      color: var(--label-tertiary);
      font-size: 10px;
      letter-spacing: 0.01em;
    }
    .tab-btn.active { color: var(--tint-text); }
    .tab-btn svg { width: 26px; height: 26px; }

    .tab-fab {
      flex: 0 0 56px;
      width: 56px;
      height: 56px;
      margin: 0 12px;
      background: var(--tint);
      color: var(--on-tint);
      border: none;
      border-radius: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.12s, background 0.12s;
    }
    .tab-fab:active {
      transform: scale(0.94);
      background: var(--tint-pressed);
    }
    .tab-fab svg { width: 28px; height: 28px; }

    /* ───────── AUTH ───────── */
    #auth-screen {
      background: var(--bg);
      padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
      position: relative;
    }
    .auth-inner {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      max-width: 360px;
      width: 100%;
      margin: 0 auto;
      padding: 40px 0;
    }
    .auth-logo {
      width: 76px;
      height: 76px;
      border-radius: 20px;
      background: var(--tint);
      color: var(--on-tint);
      margin: 0 auto 20px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .auth-logo svg { width: 40px; height: 40px; }
    .auth-title {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -0.4px;
      text-align: center;
      margin-bottom: 6px;
      text-wrap: balance;
    }
    .auth-sub {
      font-size: 22px;
      line-height: 1.3;
      color: var(--label-tertiary);
      text-align: center;
      margin-bottom: 28px;
      text-wrap: balance;
    }
    .auth-field {
      width: 100%;
      padding: 13px 14px;
      background: var(--bg-elevated);
      border: 0.5px solid var(--separator-strong);
      border-radius: 12px;
      font-size: 17px;
      color: var(--label);
      outline: none;
      margin-bottom: 10px;
      -webkit-appearance: none;
    }
    .auth-field:focus { border-color: var(--tint); }
    .auth-error {
      color: var(--destructive);
      font-size: 13px;
      text-align: center;
      margin-top: 10px;
      min-height: 18px;
    }
    .auth-switch {
      text-align: center;
      margin-top: 18px;
      color: var(--label-tertiary);
      font-size: 15px;
    }
    .auth-switch button {
      background: none;
      border: none;
      color: var(--tint-text);
      font-size: 15px;
      font-weight: 500;
      padding: 0;
      margin-left: 4px;
    }
    .auth-link-row {
      text-align: center;
      margin-top: 14px;
    }
    .auth-link-btn {
      background: none;
      border: none;
      color: var(--tint-text);
      font-size: 14px;
      cursor: pointer;
      padding: 6px;
    }
    .btn-google {
      width: 100%;
      padding: 12px 14px;
      background: #ffffff;
      border: 1px solid var(--separator-strong);
      border-radius: 12px;
      font-size: 15px;
      font-weight: 500;
      color: var(--label);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      cursor: pointer;
      margin-bottom: 16px;
      transition: background 0.1s;
    }
    .btn-google:active { background: #f5f5f5; }
    .btn-google svg { width: 18px; height: 18px; }
    .auth-separator {
      display: flex;
      align-items: center;
      margin: 12px 0 14px;
      color: var(--label-tertiary);
      font-size: 13px;
      gap: 10px;
    }
    .auth-separator::before,
    .auth-separator::after {
      content: "";
      flex: 1;
      height: 1px;
      background: var(--separator);
    }
    .auth-hint {
      font-size: 12px;
      color: var(--label-tertiary);
      margin: -4px 4px 10px;
      line-height: 1.4;
    }
    .auth-welcome-btn {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      width: 100%;
      padding: 18px 22px;
      margin: 0 0 14px;
      background: var(--tint);
      color: var(--on-tint);
      border: 0;
      border-radius: 18px;
      text-align: left;
      cursor: pointer;
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
      transition: transform 0.1s;
    }
    .auth-welcome-btn:active { transform: scale(0.985); }
    .auth-welcome-btn-alt {
      background: transparent;
      color: var(--tint-text);
      border: 1.5px solid var(--tint);
      box-shadow: none;
    }
    .auth-welcome-login-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      margin: -4px 0 14px;
      font-size: 15px;
      color: var(--label-tertiary);
    }
    .auth-welcome-login-row .auth-link-btn {
      font-size: 15px;
      font-weight: 600;
      padding: 4px 6px;
    }
    .auth-welcome-eyebrow {
      font-size: 13px;
      opacity: 0.9;
      margin-bottom: 2px;
      line-height: 1.2;
    }
    .auth-welcome-btn-alt .auth-welcome-eyebrow { opacity: 0.7; }
    .auth-welcome-action {
      font-size: 19px;
      font-weight: 600;
      line-height: 1.2;
    }
    .auth-invite-banner {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 12px 14px;
      margin-bottom: 18px;
      background: rgba(0, 0, 0, 0.05);
      border-radius: 14px;
      color: var(--label);
      font-size: 14px;
      line-height: 1.4;
    }
    .auth-invite-banner svg {
      flex: 0 0 auto;
      width: 20px;
      height: 20px;
      color: var(--tint-text);
      margin-top: 1px;
    }
    .auth-welcome-illustration {
      margin-top: 24px;
      text-align: center;
    }
    .auth-welcome-illustration img {
      max-width: 320px;
      width: 100%;
      height: auto;
      display: inline-block;
    }
    .auth-beta-mark {
      margin-top: 8px;
      text-align: center;
      font-size: 12px;
      color: var(--label-quaternary);
      font-variant-numeric: tabular-nums;
    }
    .auth-back-btn-top {
      position: absolute;
      top: calc(env(safe-area-inset-top) + 12px);
      left: 12px;
      z-index: 10;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: none;
      border: 0;
      color: var(--label);
      font-size: 16px;
      font-weight: 500;
      padding: 8px 10px;
      cursor: pointer;
      font-family: inherit;
      border-radius: 8px;
    }
    .auth-back-btn-top:active { background: rgba(0, 0, 0, 0.05); }
    .auth-back-btn-top svg { width: 20px; height: 20px; }
    .auth-password-wrap {
      position: relative;
    }
    .auth-password-wrap .auth-field {
      padding-right: 48px;
      width: 100%;
    }
    .auth-eye-btn {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 44px;
      background: none;
      border: 0;
      color: var(--label-tertiary);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }
    .auth-eye-btn svg { width: 20px; height: 20px; }
    .auth-eye-btn:active { color: var(--tint-text); }
    #app.onboarding-active .tab-bar { display: none; }
    .onboarding-shell {
      padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
      max-width: 480px;
      margin: 0 auto;
    }
    .onboarding-title {
      font-family: 'Fraunces', 'New York', Georgia, serif;
      font-size: 32px;
      font-weight: 700;
      letter-spacing: -0.5px;
      line-height: 1.1;
      margin-bottom: 12px;
      text-wrap: balance;
    }
    .onboarding-sub {
      font-size: 16px;
      line-height: 1.5;
      color: var(--label-secondary);
      margin-bottom: 28px;
      text-wrap: balance;
    }
    .onboarding-avatar {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      background: none;
      border: 0;
      padding: 0;
      margin: 0 auto 28px;
      cursor: pointer;
      width: 100%;
    }
    .ob-avatar-circle {
      width: 96px;
      height: 96px;
      border-radius: 50%;
      background: #e5e7eb;
      color: var(--on-tint);
      font-size: 36px;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;
    }
    .ob-avatar-circle .avatar-img {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      object-fit: cover;
    }
    .ob-avatar-label {
      font-size: 14px;
      color: var(--tint-text);
      font-weight: 600;
    }
    .onboarding-section {
      margin-bottom: 24px;
    }
    .onboarding-section-title {
      font-size: 13px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--label-tertiary);
      margin-bottom: 4px;
    }
    .onboarding-section-hint {
      font-size: 13px;
      color: var(--label-tertiary);
      line-height: 1.4;
      margin-bottom: 12px;
    }
    .onboarding-label {
      display: block;
      font-size: 13px;
      color: var(--label-tertiary);
      margin: 12px 4px 4px;
    }
    .onboarding-input {
      width: 100%;
      padding: 13px 14px;
      background: var(--bg-elevated);
      border: 1px solid var(--separator);
      border-radius: 12px;
      font-size: 16px;
      font-family: inherit;
      color: var(--label);
      outline: none;
      transition: border-color 0.1s;
    }
    .onboarding-input:focus { border-color: var(--tint); }
    .onboarding-compleanno {
      display: grid;
      grid-template-columns: 1fr 1.4fr 1fr;
      gap: 8px;
    }
    .onboarding-compleanno select {
      padding: 13px 10px;
      background: var(--bg-elevated);
      border: 1px solid var(--separator);
      border-radius: 12px;
      font-size: 16px;
      font-family: inherit;
      color: var(--label);
    }
    .onboarding-cap-row {
      display: grid;
      grid-template-columns: 1fr 2fr;
      gap: 8px;
    }
    .onboarding-submit {
      width: 100%;
      margin-top: 12px;
    }
    .onboarding-header {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 18px;
      min-height: 32px;
    }
    .onboarding-back {
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: 0;
      color: var(--label);
      padding: 6px 8px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .onboarding-back svg { width: 22px; height: 22px; }
    .onboarding-back:active { color: var(--tint-pressed); }
    .onboarding-progress {
      display: inline-flex;
      gap: 8px;
    }
    .ob-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #e1e1e1;
      transition: background 0.2s;
    }
    .ob-dot.active { background: var(--tint); }
    .onboarding-skip {
      display: block;
      width: 100%;
      background: none;
      border: 0;
      color: var(--label-tertiary);
      font-size: 15px;
      padding: 12px 0;
      margin-top: 4px;
      cursor: pointer;
      font-family: inherit;
    }
    .onboarding-skip:active { color: var(--label-secondary); }
    .auth-privacy-row {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      margin: 4px 4px 12px;
      font-size: 14px;
      color: var(--label-secondary);
      line-height: 1.4;
      cursor: pointer;
      user-select: none;
    }
    .auth-privacy-row input[type="checkbox"] {
      flex: 0 0 auto;
      width: 18px;
      height: 18px;
      margin-top: 2px;
      accent-color: var(--tint);
      cursor: pointer;
    }
    .auth-privacy-row a {
      color: var(--tint-text);
      text-decoration: none;
    }
    .auth-privacy-row a:hover { text-decoration: underline; }

    /* ───────── MISC ───────── */
    #toast {
      position: fixed;
      bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
      left: 16px;
      right: 16px;
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 16px;
      border-radius: 14px;
      font-size: 19px;
      line-height: 1.35;
      color: white;
      background: var(--success);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
      transform: translateY(12px);
      opacity: 0;
      transition: all 0.18s;
      pointer-events: none;
      z-index: 1000;
      text-align: left;
    }
    #toast[data-type="error"] { background: var(--destructive); }
    #toast.show { opacity: 1; transform: translateY(0); }
    .toast-icon {
      flex: 0 0 auto;
      width: 26px;
      height: 26px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .toast-icon svg { width: 26px; height: 26px; }
    .toast-msg { flex: 1; min-width: 0; }
    @media (min-width: 700px) {
      #toast {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(12px);
        max-width: 480px;
        width: calc(100% - 32px);
      }
      #toast.show { transform: translateX(-50%) translateY(0); }
    }

    .loading {
      padding: 40px 0;
      text-align: center;
      color: var(--label-tertiary);
      font-size: 14px;
    }
    .empty {
      padding: 64px 32px;
      text-align: center;
      color: var(--label-tertiary);
    }
    .rubrica-banner {
      display: flex;
      align-items: center;
      gap: 12px;
      width: calc(100% - 32px);
      margin: 12px 16px 4px;
      padding: 14px 16px;
      background: var(--bg-elevated);
      border: 0;
      border-radius: 14px;
      box-shadow: inset 3px 0 0 var(--tint);
      text-align: left;
      cursor: pointer;
      font: inherit;
      color: inherit;
    }
    .rubrica-banner-body { flex: 1; min-width: 0; }
    .rubrica-banner-title {
      font-size: 15px;
      font-weight: 600;
      color: var(--label);
    }
    .rubrica-banner-sub {
      font-size: 13px;
      color: var(--label-secondary);
      margin-top: 2px;
      line-height: 1.35;
    }
    .rubrica-banner-arrow {
      flex: 0 0 auto;
      display: inline-flex;
      color: var(--chevron);
    }
    .rubrica-banner-soft {
      box-shadow: none;
      background: rgba(0, 0, 0, 0.05);
      padding: 0;
      gap: 0;
    }
    .rubrica-banner-soft .rubrica-banner-body-btn {
      flex: 1;
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 16px;
      background: none;
      border: 0;
      text-align: left;
      cursor: pointer;
      font: inherit;
      color: inherit;
      min-width: 0;
    }
    .rubrica-banner-dismiss {
      flex: 0 0 auto;
      width: 44px;
      align-self: stretch;
      background: none;
      border: 0;
      color: var(--label-tertiary);
      font-size: 22px;
      cursor: pointer;
      line-height: 1;
    }
    .rubrica-banner-dismiss:active { color: var(--label-secondary); }
    .rubrica-hint {
      padding: 8px 24px 12px;
      font-size: 13px;
      color: var(--label-tertiary);
      text-align: center;
      line-height: 1.4;
    }
    .scheda-edit-hint {
      margin: 12px 16px 4px;
      padding: 14px 16px;
      background: var(--bg-elevated);
      border-radius: 14px;
      box-shadow: inset 3px 0 0 var(--tint);
    }
    .scheda-edit-hint-title {
      font-size: 15px;
      font-weight: 600;
      color: var(--label);
      line-height: 1.3;
    }
    .scheda-edit-hint-sub {
      font-size: 13px;
      color: var(--label-secondary);
      margin-top: 4px;
      line-height: 1.4;
    }
    .empty-icon {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: rgba(118, 118, 128, 0.12);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 14px;
      color: var(--label-quaternary);
    }
    .empty h3 {
      font-size: 17px;
      font-weight: 600;
      color: var(--label);
      margin-bottom: 4px;
    }
    .empty p { font-size: 14px; line-height: 1.4; }
    .empty-reload {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 20px;
      margin: 10px 0 18px;
      background: var(--tint);
      color: var(--on-tint);
      border: 0;
      border-radius: 22px;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
      transition: transform 0.1s;
    }
    .empty-reload:active { transform: scale(0.97); }
    .empty-reload svg { width: 18px; height: 18px; }
    .empty-reload.spinning svg { animation: empty-reload-spin 0.8s linear infinite; }
    @keyframes empty-reload-spin { to { transform: rotate(360deg); } }
    .logout-overlay {
      position: fixed;
      inset: 0;
      background: rgba(255, 255, 255, 0.94);
      backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
      z-index: 10000;
      font-size: 17px;
      color: var(--label-secondary);
    }
    .logout-spinner {
      width: 32px;
      height: 32px;
      border: 3px solid #e1e1e1;
      border-top-color: var(--tint);
      border-radius: 50%;
      animation: empty-reload-spin 0.8s linear infinite;
    }
    .qr-loading, .qr-error {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
      width: 240px;
      height: 240px;
      margin: 0 auto;
      color: var(--label-secondary);
      font-size: 14px;
      text-align: center;
    }
    .qr-error p { line-height: 1.4; }

    /* ───────── DESKTOP ───────── */
    @media (min-width: 700px) {
      body { background: #e5e5ea; }
      #app.ready {
        max-width: 480px;
        margin: 0 auto;
        background: var(--bg);
        min-height: 100vh;
        box-shadow: 0 0 0 1px var(--separator);
      }
      .tab-bar {
        width: 480px;
        max-width: none;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
      }
    }

    /* ───────── MODALITÀ DEMO (solo anteprime, vedi demo.js) ───────── */
    .demo-tag {
      position: fixed;
      top: calc(env(safe-area-inset-top) + 16px);
      left: 50%;
      transform: translateX(-50%);
      z-index: 1000;
      padding: 5px 12px;
      background: var(--bg-elevated);
      color: var(--label-secondary);
      border: 1px solid var(--outline);
      border-radius: 9999px;
      font-size: 13px;
      font-weight: 500;
      letter-spacing: 0.01em;
    }
    .demo-tag:active { opacity: 0.6; }
